Пример #1
0
        /// <summary>
        /// Configures cache manager logging to use a <c>Microsoft.Extensions.Logging.ILoggerFactory</c>
        /// which gets resolved from the <paramref name="serviceCollection"/>.
        /// </summary>
        /// <param name="part">The builder part.</param>
        /// <param name="serviceCollection">The services collection.</param>
        /// <returns>The builder.</returns>
        public static ConfigurationBuilderCachePart WithMicrosoftLogging(this ConfigurationBuilderCachePart part, IServiceCollection serviceCollection)
        {
            NotNull(part, nameof(part));
            NotNull(serviceCollection, nameof(serviceCollection));

            return(part.WithLogging(typeof(MicrosoftLoggerFactoryAdapter), new Func <ILoggerFactory>(() => GetLoggerFactory(serviceCollection))));
        }
Пример #2
0
        public static ConfigurationBuilderCachePart WithMicrosoftLogging(this ConfigurationBuilderCachePart part, Action <ILoggerFactory> factory)
        {
            NotNull(part, nameof(part));
            NotNull(factory, nameof(factory));
            var externalFactory = new LoggerFactory();

            factory(externalFactory);
            return(part.WithLogging(typeof(MicrosoftLoggerFactoryAdapter), externalFactory));
        }
Пример #3
0
 /// <summary>
 /// Enables logging for the cache manager instance.
 /// This will add an <see cref="Logging.ILoggerFactory"/> using the <c>Microsoft.Extensions.Logging</c> framework.
 /// </summary>
 /// <param name="part">The builder part.</param>
 /// <param name="loggerFactory">The logger factory which should be used.</param>
 /// <returns>The builder.</returns>
 public static ConfigurationBuilderCachePart WithMicrosoftLogging(this ConfigurationBuilderCachePart part, ILoggerFactory loggerFactory)
 {
     NotNull(part, nameof(part));
     NotNull(loggerFactory, nameof(loggerFactory));
     return(part.WithLogging(typeof(MicrosoftLoggerFactoryAdapter), loggerFactory));
 }
Пример #4
0
 /// <summary>
 /// Enables logging for the cache manager instance.
 /// This will add an <see cref="Logging.ILoggerFactory"/> using the <c>NLog</c> framework.
 /// </summary>
 /// <param name="part">The builder part.</param>
 /// <returns>The builder.</returns>
 public static ConfigurationBuilderCachePart WithNLogLogging(this ConfigurationBuilderCachePart part)
 {
     NotNull(part, nameof(part));
     return(part.WithLogging(typeof(NLoggerFactoryAdapter)));
 }