コード例 #1
0
 private void ParseLogCastOptions(StringDictionary attributes)
 {
     Options = LogCastOptions.Parse(
         attributes["endpoint"],
         attributes["throttling"],
         attributes["retryTimeout"],
         attributes["sendingThreadCount"],
         attributes["sendTimeout"],
         attributes["enableSelfDiagnostics"]);
 }
コード例 #2
0
ファイル: DirectLogManager.cs プロジェクト: kbabiy/LogCast
        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));
        }
コード例 #3
0
ファイル: DirectLogManager.cs プロジェクト: kbabiy/LogCast
        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);
        }
コード例 #4
0
        public void Initialize(LogCastOptions options, IFallbackLogger fallbackLogger)
        {
            if (IsInitialized)
            {
                throw new InvalidOperationException("LogCast engine is already initialized!");
            }

            _fallbackLogger = fallbackLogger;
            _client         = _clientFactory.Create(options, fallbackLogger);
            _enableStats    = options.EnableSelfDiagnostics;

            IsInitialized = true;
        }
コード例 #5
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));
            }
        }
コード例 #6
0
ファイル: DirectLogManager.cs プロジェクト: kbabiy/LogCast
        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);
        }
コード例 #7
0
ファイル: when_creating.cs プロジェクト: kbabiy/LogCast
 public void then_throttling_10_does_not_throws()
 {
     new LogCastClient(LogCastOptions.Parse("http://host", "10", null, "10", null, null), Mock.Of <IFallbackLogger>());
 }
コード例 #8
0
ファイル: when_creating.cs プロジェクト: kbabiy/LogCast
 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>()));
 }
コード例 #9
0
 public LogCastClientMock(LogCastOptions options)
 {
     Options = options;
 }
コード例 #10
0
 public override void Act()
 {
     _cut = new LogCastOptions(Url);
 }
コード例 #11
0
ファイル: Context.cs プロジェクト: 7digital/LogCast
 public FailingLogCastClientMock(LogCastOptions options, IFallbackLogger fallbackLogger, int failedCount)
     : base(options, fallbackLogger)
 {
     _failedCount = failedCount;
 }
コード例 #12
0
ファイル: Context.cs プロジェクト: kbabiy/LogCast
 public GloballyFailingLogCastClientMock(LogCastOptions options, IFallbackLogger fallbackLogger)
     : base(options, fallbackLogger)
 {
 }
コード例 #13
0
ファイル: Context.cs プロジェクト: 7digital/LogCast
 public LogCastClientMock(LogCastOptions options, IFallbackLogger fallbackLogger)
     : base(options, fallbackLogger)
 {
     Messages = new List <string>();
 }
コード例 #14
0
        public ILogCastClient Create(LogCastOptions options, IFallbackLogger logger)
        {
            ConfiguredClient = ConfiguredClient ?? new LogCastClientMock(options);

            return(ConfiguredClient);
        }
コード例 #15
0
ファイル: EmptyLogCastEngine.cs プロジェクト: kbabiy/LogCast
 public void Initialize(LogCastOptions options, IFallbackLogger fallbackLogger)
 {
 }