Example #1
0
        //默认 LoggerConfiguration 添加
        public static ILoggerFactory AddColorConsoleLogger(
            this ILoggerFactory loggerFactory)
        {
            var config = new ColorConsoleLoggerConfiguration();

            return(loggerFactory.AddColorConsoleLogger(config));
        }
Example #2
0
        //工厂添加 自定义LoggerProvider (LoggerConfiguration new object)
        public static ILoggerFactory AddColorConsoleLogger(
            this ILoggerFactory loggerFactory,
            ColorConsoleLoggerConfiguration config)
        {
            loggerFactory.AddProvider(new ColorConsoleLoggerProvider(config));

            return(loggerFactory);
        }
 public ColorConsoleLoggerProvider(ColorConsoleLoggerConfiguration config)
 {
     _config = config;
 }
 public ColorConsoleLogger(string name, ColorConsoleLoggerConfiguration config)
 {
     _name   = name;
     _config = config;
 }