Skip to content

serilog/serilog-sinks-observable

Repository files navigation

Serilog.Sinks.Observable Build status NuGet Version

Write Serilog events to observers (Rx) through an IObservable.

Getting started

Install the package from NuGet:

Install-Package Serilog.Sinks.Observable

Configure Serilog using WriteTo.Observers:

Log.Logger = new LoggerConfiguration()
    .WriteTo.Observers(events => events
        .Do(evt => { 
		    Console.WriteLine($"Observed event {evt}");
		})
        .Subscribe())
    .CreateLogger();

Log.Information("Hello, observers!");

Log.CloseAndFlush();

More information about using Serilog is available in the Serilog Documentation.

Copyright © 2016 Serilog Contributors - Provided under the Apache License, Version 2.0.