Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathStackifyLogger.cs
More file actions
Latest commit
53 lines (46 loc) · 1.24 KB
/
Copy pathStackifyLogger.cs
File metadata and controls
53 lines (46 loc) · 1.24 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
usingSystem;
usingMicrosoft.Extensions.Logging;
usingStackifyLib.Models;
namespaceStackifyLib.CoreLogger
{
publicclassStackifyLogger:Microsoft.Extensions.Logging.ILogger
{
publicIDisposableBeginScope<TState>(TStatestate)
{
returnnull;
}
publicboolIsEnabled(LogLevellogLevel)
{
returntrue;
}
publicvoidLog<TState>(LogLevellogLevel,EventIdeventId,TStatestate,Exceptionexception,Func<TState,Exception,string>formatter)
{
if(formatter==null)
{
thrownewArgumentNullException("formatter");
}
varmessage=formatter(state,exception);
if(string.IsNullOrEmpty(message))
{
return;
}
varmsg=newLogMsg
{
Level=logLevel.ToString(),
Msg=message
};
StackifyLib.Logger.QueueLogObject(msg,exception);
}
publicvoidClose()
{
try
{
StackifyLib.Logger.Shutdown();
}
catch(Exception)
{
// ignored
}
}
}
}