/// <summary> /// Adds a Slack logger that logs to the essential Slack channels /// </summary> /// <param name="factory">The <see cref="ILogFactory"/> to use.</param> /// <param name="azureQueueConnectionString">Azure storage queue connection string</param> /// <param name="azureQueuesBaseName">Azure queue base name</param> /// <param name="configure">Optional configuration</param> public static ILogFactory AddEssentialSlackChannels( [NotNull] this ILogFactory factory, [NotNull] string azureQueueConnectionString, [NotNull] string azureQueuesBaseName, Action <SlackLoggerOptions> configure = null) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } if (string.IsNullOrWhiteSpace(azureQueueConnectionString)) { throw new ArgumentNullException(nameof(azureQueueConnectionString)); } if (string.IsNullOrWhiteSpace(azureQueuesBaseName)) { throw new ArgumentNullException(); } var spamGuard = SlackSpamGuardBuilder.BuildForEssentialSlackChannelsSpamGuard(); var options = new SlackLoggerOptions(spamGuard); configure?.Invoke(options); factory.AddProvider(new SlackLoggerProvider( azureQueueConnectionString, azureQueuesBaseName, spamGuard, SlackChannelResolvers.EssentialChannelsResolver, options.FilterOutChaosException)); return(factory); }
private static ILogFactory AddConsole( [NotNull] this ILogFactory factory, [NotNull] ConsoleLoggerOptions options, [NotNull] IConsoleLogMessageWriter messageWriter) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } factory.AddProvider(new LykkeConsoleLoggerProvider(options, messageWriter)); return(factory); }
/// <summary> /// Adds an Azure table logger /// </summary> /// <param name="factory">The <see cref="ILogFactory"/> to use.</param> /// <param name="tableName">Table name to which logs will be written</param> /// <param name="connectionString">Azure storage connection string</param> /// <param name="configure">Optional configuration</param> public static ILogFactory AddAzureTable( [NotNull] this ILogFactory factory, [NotNull] IReloadingManager <string> connectionString, [NotNull] string tableName, Action <AzureTableLoggerOptions> configure = null) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } var options = new AzureTableLoggerOptions(); configure?.Invoke(options); factory.AddProvider(new AzureTableLoggerProvider(connectionString, tableName, options)); return(factory); }
/// <summary> /// Adds a Slack logger that logs entries to the additional Slack channel. /// </summary> /// <param name="factory">The <see cref="ILogBuilder"/> to use.</param> /// <param name="azureQueueConnectionString">Azure storage queue connection string</param> /// <param name="azureQueuesBaseName">Azure queue base name</param> /// <param name="channel">Channel ID</param> /// <param name="configure">Optional configuration action</param> public static ILogFactory AddAdditionalSlackChannel( [NotNull] this ILogFactory factory, [NotNull] string azureQueueConnectionString, [NotNull] string azureQueuesBaseName, [NotNull] string channel, [CanBeNull] Action <AdditionalSlackLoggerOptions> configure = null) { if (factory == null) { throw new ArgumentNullException(nameof(factory)); } if (string.IsNullOrWhiteSpace(azureQueueConnectionString)) { throw new ArgumentNullException(nameof(azureQueueConnectionString)); } if (string.IsNullOrWhiteSpace(azureQueuesBaseName)) { throw new ArgumentNullException(); } if (string.IsNullOrWhiteSpace(channel)) { throw new ArgumentNullException(nameof(channel)); } var spamGuard = SlackSpamGuardBuilder.BuildForAdditionalSlackChannel(); var options = new AdditionalSlackLoggerOptions(spamGuard); options.DisableChaosExceptionFiltering(); configure?.Invoke(options); factory.AddProvider(new SlackLoggerProvider( azureQueueConnectionString, azureQueuesBaseName, spamGuard, SlackChannelResolvers.GetAdditionalChannelResolver(options.MinLogLevel, channel), options.FilterOutChaosException) ); return(factory); }