-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathLogging.cs
35 lines (33 loc) · 1.13 KB
/
Logging.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
34
35
using Canister.Interfaces;
using Microsoft.Extensions.DependencyInjection;
using Serilog;
namespace SQLHelperDB.SpeedTests.Modules
{
/// <summary>
/// Logging module
/// </summary>
/// <seealso cref="Canister.Interfaces.IModule"/>
public class LoggingModule : IModule
{
/// <summary>
/// Order to run this in
/// </summary>
public int Order => 1;
/// <summary>
/// Loads the module using the bootstrapper
/// </summary>
/// <param name="bootstrapper">The bootstrapper.</param>
public void Load(IServiceCollection bootstrapper)
{
if (bootstrapper is null)
return;
Log.Logger = new LoggerConfiguration()
.WriteTo
.File("./Log.txt")
.MinimumLevel
.Error()
.CreateLogger();
bootstrapper.AddSingleton<ILogger>(_ => Log.Logger);
}
}
}