private void ParseLogCastOptions(StringDictionary attributes) { Options = LogCastOptions.Parse( attributes["endpoint"], attributes["throttling"], attributes["retryTimeout"], attributes["sendingThreadCount"], attributes["sendTimeout"], attributes["enableSelfDiagnostics"]); }
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)); }
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); }
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; }
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)); } }
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); }
public void then_throttling_10_does_not_throws() { new LogCastClient(LogCastOptions.Parse("http://host", "10", null, "10", null, null), Mock.Of <IFallbackLogger>()); }
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>())); }
public LogCastClientMock(LogCastOptions options) { Options = options; }
public override void Act() { _cut = new LogCastOptions(Url); }
public FailingLogCastClientMock(LogCastOptions options, IFallbackLogger fallbackLogger, int failedCount) : base(options, fallbackLogger) { _failedCount = failedCount; }
public GloballyFailingLogCastClientMock(LogCastOptions options, IFallbackLogger fallbackLogger) : base(options, fallbackLogger) { }
public LogCastClientMock(LogCastOptions options, IFallbackLogger fallbackLogger) : base(options, fallbackLogger) { Messages = new List <string>(); }
public ILogCastClient Create(LogCastOptions options, IFallbackLogger logger) { ConfiguredClient = ConfiguredClient ?? new LogCastClientMock(options); return(ConfiguredClient); }
public void Initialize(LogCastOptions options, IFallbackLogger fallbackLogger) { }