-
Notifications
You must be signed in to change notification settings - Fork 4
/
WebloggerSinkExtensions.cs
33 lines (31 loc) · 1.27 KB
/
WebloggerSinkExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using Serilog;
using Serilog.Configuration;
using System;
namespace WebLogger
{
/// <summary>
/// Creates a new Serilog Sink
/// </summary>
public static class WebloggerSinkExtensions
{
/// <summary>
/// Provides an extension method to register the sink with the serilog configuration.
/// </summary>
/// <param name="loggerConfiguration">This logger configuration.</param>
/// <param name="options">WebLogger factory options configures the weblogger</param>
/// <param name="logger">Provides access to the logger after the sink has constructed the logger</param>
/// <param name="formatProvider">The format provider.</param>
/// <param name="renderer">Optional rendering used to format the serilog outputs</param>
/// <returns></returns>
public static LoggerConfiguration WebloggerSink(
this LoggerSinkConfiguration loggerConfiguration,
Action<WebLoggerOptions> options,
Action<IWebLogger> logger,
IFormatProvider formatProvider = null,
IRenderMessages renderer = null)
{
var sink = new WebLoggerSink(options, logger, formatProvider, renderer);
return loggerConfiguration.Sink(sink);
}
}
}