Example #1
0
        private void Init(DirectLoggerOptions loggerOptions, LogCastOptions logCastOptions)
        {
            Options         = loggerOptions;
            _logCastOptions = logCastOptions;
            _falbackLogger  = new FileFallbackLogger(loggerOptions.FallbackLogDirectory,
                                                     loggerOptions.DaysToKeepFallbackLogs);

            _logger = new DirectLogger(loggerOptions.MinLogLevel,
                                       new LogMessageRouter(loggerOptions.SkipPercentage),
                                       _falbackLogger,
                                       string.IsNullOrEmpty(loggerOptions.Layout) ? null : new MessageLayout(loggerOptions.Layout));
        }
Example #2
0
        public DirectLogManager(DirectLoggerOptions loggerOptions, LogCastOptions logCastOptions)
        {
            if (loggerOptions == null)
            {
                throw new ArgumentNullException(nameof(loggerOptions));
            }
            if (logCastOptions == null)
            {
                throw new ArgumentNullException(nameof(logCastOptions));
            }

            Init(loggerOptions, logCastOptions);
        }
Example #3
0
        public DirectLogManager()
        {
            var configuration = ConfigurationSection.Read();

            var logLevel      = (LogLevel)Enum.Parse(typeof(LogLevel), configuration.LogLevel);
            var loggerOptions = new DirectLoggerOptions(logLevel, configuration.Type)
            {
                Layout = configuration.Layout,
                FallbackLogDirectory   = configuration.FallbackLogDirectory,
                DaysToKeepFallbackLogs = configuration.DaysToKeepFallbackLogs
            };

            var logCastOptions = LogCastOptions.Parse(configuration.Endpoint, configuration.Throttling,
                                                      null, configuration.SendingThreadCount, null, configuration.EnableSelfDiagnostics);

            Init(loggerOptions, logCastOptions);
        }