public AzureTableLoggerProvider( [NotNull] IReloadingManager <string> connectionString, [NotNull] string tableName, [NotNull] AzureTableLoggerOptions options) { _loggers = new ConcurrentDictionary <string, AzureTableLogger>(); var storage = AzureTableStorage <LogEntity> .Create(connectionString, tableName, LogFactory.LastResort); _persistenceQueue = new AzureTableLogPersistenceQueue( storage, "General log", LogFactory.LastResort, options.MaxBatchLifetime, options.BatchSizeThreshold); }
/// <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); }
public static ILogBuilder AddAzureTable( [NotNull] this ILogBuilder builder, [NotNull] IReloadingManager <string> connectionString, [NotNull] string tableName, [CanBeNull] Action <AzureTableLoggerOptions> configure = null) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } var options = new AzureTableLoggerOptions(); configure?.Invoke(options); builder.Services.AddSingleton <ILoggerProvider, AzureTableLoggerProvider>(s => new AzureTableLoggerProvider( connectionString, tableName, options)); return(builder); }