Пример #1
0
        public ILogger CreateLogger(string categoryName)
        {
            var logLevelFilter = Utilities.GetLogLevelFilter(categoryName, this.LogLevelsByCategoryName);

            var logger = new SimpleConsoleLogger(categoryName, logLevelFilter);

            return(logger);
        }
        public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
        {
            if (!this.IsEnabled(logLevel))
            {
                return;
            }

            var formattedStateAndException = formatter(state, exception);

            using (var consoleSynchronizationContext = ConsoleSynchronization.GetContext())
            {
                SimpleConsoleLogger.PerformLogging(logLevel, this.CategoryName, eventId, formattedStateAndException);
            }
        }