Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SQLiteSink.cs #16

Merged
merged 1 commit into from
Aug 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Update SQLiteSink.cs
In the class SQLiteSink.cs call InitializeDatabase (); before ... if (retentionPeriod.HasValue) {... and not later. I have done it and correct the error. Issues #15
  • Loading branch information
yoandydt authored Aug 27, 2018
commit 7ff2a16484513c190d63f54bdecb86b5cae5121b
5 changes: 3 additions & 2 deletions src/Serilog.Sinks.SQLite/Sinks/SQLite/SQLiteSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public SQLiteSink(
_tableName = tableName;
_formatProvider = formatProvider;
_storeTimestampInUtc = storeTimestampInUtc;

InitializeDatabase();

if (retentionPeriod.HasValue) {
// impose a min retention period of 15 minute
Expand All @@ -68,8 +70,7 @@ public SQLiteSink(
TimeSpan.FromMinutes(0),
TimeSpan.FromMinutes(retentionCheckMinutes));
}

InitializeDatabase();

}

private static string CreateConnectionString(string dbPath) =>
Expand Down