Exemple #1
0
 public SqliteLoggerWriter(SqliteLoggerOptions options)
 {
     Options       = options;
     _logDir       = Options.Path ?? Path.Combine(AppContext.BaseDirectory, "logs");
     _dbConnection = new SQLiteConnection();
     BeginAsyncQueueWriter();
 }
        public static ILoggerFactory AddSqlite(this ILoggerFactory factory, Action <SqliteLoggerOptions> options = null)
        {
            var option = new SqliteLoggerOptions();

            options?.Invoke(option);
            factory.AddProvider(new SqliteLoggerProvider(option));
            return(factory);
        }
        public static ILoggingBuilder AddSqlite(this ILoggingBuilder builder, Action <SqliteLoggerOptions> options = null)
        {
            var option = new SqliteLoggerOptions();

            options?.Invoke(option);
            builder.Services.AddSingleton(option);
            builder.Services.AddSingleton <ILoggerProvider, SqliteLoggerProvider>();
            return(builder);
        }
 public SqliteLoggerProvider(SqliteLoggerOptions options)
 {
     _options          = options;
     _fileLoggerWriter = new SqliteLoggerWriter(options);
 }