示例#1
0
 public static ILoggingBuilder AddNLog(this ILoggingBuilder builder, Func <string, Microsoft.Extensions.Logging.LogLevel, bool> filter, string nlogConfigFile = "nlog.config")
 {
     LayoutExtentions.ReisterNlogLayout();
     builder.AddFilter(filter);
     builder.Services.AddSingleton <ILoggerProvider>(sp => new NLogProvider());
     return(builder);
 }
示例#2
0
 public static ILoggerFactory AddNLog(this ILoggerFactory factory, string nlogConfigFile = "NLog.config")
 {
     LayoutExtentions.ReisterNlogLayout();
     LogManager.LoadConfiguration(nlogConfigFile);
     factory.AddProvider(new NLogProvider());
     return(factory);
 }
        public static IServiceCollection AddBlueCatMongoNLogServices(this IServiceCollection services)
        {
            services.AddLogging(op =>
            {
                LayoutExtentions.ReisterNlogLayout();
            });

            return(services);
        }
示例#4
0
 public static ILoggingBuilder AddNLog(this ILoggingBuilder builder, string nlogConfigFile = "nlog.config")
 {
     LayoutExtentions.ReisterNlogLayout();
     builder.Services.AddSingleton <ILoggerProvider>(sp => new NLogProvider());
     return(builder);
 }