private void ParseLogCastOptions(StringDictionary attributes)
 {
     Options = LogCastOptions.Parse(
         attributes["endpoint"],
         attributes["throttling"],
         attributes["retryTimeout"],
         attributes["sendingThreadCount"],
         attributes["sendTimeout"],
         attributes["enableSelfDiagnostics"]);
 }
Esempio n. 2
0
        private void Initialize()
        {
            FallbackLogger = CreateFallbackLogger();
            Options        = LogCastOptions.Parse(
                Endpoint, Throttling, RetryTimeout, SendingThreadCount, SendTimeout, EnableSelfDiagnostics);

            _messageRouter = new LogMessageRouter(ParseSkipPercentage(SkipPercentage));

            // This case is mostly for scenario when a client uses "real" NLog LogManager
            // and doesn't use our ILogger/LogManager/LogConfig
            if (!LogConfig.IsConfigured && !LogConfig.IsInProgress)
            {
                LogConfig.Configure(new NLogManager(this));
            }
        }
Esempio n. 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);
        }
Esempio n. 4
0
 public void then_throttling_10_does_not_throws()
 {
     new LogCastClient(LogCastOptions.Parse("http://host", "10", null, "10", null, null), Mock.Of <IFallbackLogger>());
 }
Esempio n. 5
0
 public void then_throttling_less_than_10_throws()
 {
     Assert.Throws <ArgumentException>(() =>
                                       new LogCastClient(LogCastOptions.Parse("http://host", "9", null, "10", null, null), Mock.Of <IFallbackLogger>()));
 }