Skip to content

Commit

Permalink
Merge pull request #76 from nblumhardt/fix-75
Browse files Browse the repository at this point in the history
Consistently use `*Async()` methods so that background level checks occur
  • Loading branch information
nblumhardt authored Jul 25, 2017
2 parents bd714cc + 437de68 commit c5c54a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sample/Sample/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ public static void Main(string[] args)
.MinimumLevel.ControlledBy(levelSwitch)
.WriteTo.LiterateConsole()
.WriteTo.Seq("http://localhost:5341",
apiKey: "yeEZyL3SMcxEKUijBjN",
apiKey: "o6nYf3WWnzF43Uu5PZWJ",
controlLevelSwitch: levelSwitch)
.CreateLogger();

Log.Information("Sample starting up");

foreach (var i in Enumerable.Range(0, 1000))
{
Log.Information("Running loop {Counter}", i);
Log.Information("Running loop {Counter}, switch is at {Level}", i, levelSwitch.MinimumLevel);

Thread.Sleep(1000);
Log.Debug("Loop iteration done");
Expand Down
4 changes: 2 additions & 2 deletions src/Serilog.Sinks.Seq/Sinks/Seq/SeqSink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ protected override void Dispose(bool disposing)

// The sink must emit at least one event on startup, and the server be
// configured to set a specific level, before background level checks will be performed.
protected override void OnEmptyBatch()
protected override async Task OnEmptyBatchAsync()
{
if (_controlledSwitch.IsActive &&
_nextRequiredLevelCheckUtc < DateTime.UtcNow)
{
EmitBatch(Enumerable.Empty<LogEvent>());
await EmitBatchAsync(Enumerable.Empty<LogEvent>());
}
}

Expand Down

0 comments on commit c5c54a5

Please sign in to comment.