Exemplo n.º 1
0
        static void Main(string[] args)
        {
            var config = new LoggingConfiguration();

            config.AddEventLog(LogLevel.Trace, LogLevel.Error);
            config.AddConsole(LogLevel.Trace, LogLevel.Error);
            config.AddTxtFile(LogLevel.Trace, LogLevel.Error);
            config.AddDebugger();
            LogManager.Configuration = config;

            var logger = LogManager.GetLogger("Example");

            logger.Trace("trace log message");
            logger.Debug("debug log message");
            logger.Info("info log message");
            logger.Warn("warn log message");
            logger.Error("error log message");
            logger.Fatal("fatal log message");

            System.Console.WriteLine();
            foreach (var item in LogLevel.AllLevels)
            {
                System.Console.WriteLine($"{item.Ordinal} {item.Name}");
            }
            System.Console.ReadKey();
        }