Ejemplo n.º 1
0
 private static void InitLoggers()
 {
     Logger.Level = LogLevel.Trace;
     Logger.RegisterReceiver(new ColouredConsoleLogger(LogLevel.Info));
     _fileLogger = new BufferedFileLogger(FileName, LogLevel.Trace, true, 5000, 10000);
     Logger.RegisterReceiver(_fileLogger);
     Console.OutputEncoding = Encoding.UTF8;
 }
Ejemplo n.º 2
0
        private void InitLoggers()
        {
            Logger.Level = LogLevel.Trace;

            var logDirectory = Environment.CurrentDirectory + "\\Log";

            if (!Directory.Exists(logDirectory))
            {
                Directory.CreateDirectory(logDirectory);
            }

            var logFile    = logDirectory + $"\\{DateTime.Now:yyyy-MM-dd HH-mm-ss}.txt";
            var fileLogger = new BufferedFileLogger(logFile);

            Logger.RegisterReceiver(fileLogger);

            _observableLogger = new ObservableLogger(1000, RunOnUiThreadAsync);
            Logger.RegisterReceiver(_observableLogger);

            Logger.RegisterReceiver(new DebugLogger());
        }
Ejemplo n.º 3
0
        private static void InitializeLoggers()
        {
            Logger.Level = Configuration.LogLevel;

            if (Configuration.LoggerMode.HasFlag(LoggerMode.Console))
            {
                Console.OutputEncoding = Encoding.UTF8;
                Console.InputEncoding  = Encoding.Unicode;
                Console.Title          = @"ITCC Test Server 2016";
                var consoleLogger = new ColouredConsoleLogger();
                Logger.RegisterReceiver(consoleLogger, true);
            }

            if (Configuration.LoggerMode.HasFlag(LoggerMode.File))
            {
                var logFileName = Configuration.LogDirectory + @"\" + DateTime.Now.ToString("yyyy-MM-dd HH-mm-ss") + ".txt";
                var fileLogger  = new BufferedFileLogger(logFileName);
                Logger.RegisterReceiver(fileLogger, true);
            }

            Logger.LogEntry("MAIN", LogLevel.Info, $"Loggers initialized: {Configuration.LoggerMode}");
        }