-
-
Notifications
You must be signed in to change notification settings - Fork 55
Expand file tree
/
Copy pathLoggerAdapter.cs
More file actions
44 lines (40 loc) · 1.29 KB
/
LoggerAdapter.cs
File metadata and controls
44 lines (40 loc) · 1.29 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
using Microsoft.Extensions.Logging;
using NuGet.Common;
using LogLevel = NuGet.Common.LogLevel;
namespace Beutl.Api.Services;
public class LoggerAdapter(Microsoft.Extensions.Logging.ILogger logger) : LoggerBase
{
private readonly Microsoft.Extensions.Logging.ILogger _logger = logger;
public override void Log(ILogMessage message)
{
switch (message.Level)
{
case LogLevel.Debug:
_logger.LogDebug(message.ToString());
break;
case LogLevel.Information:
_logger.LogInformation(message.ToString());
break;
case LogLevel.Warning:
_logger.LogWarning(message.ToString());
break;
case LogLevel.Error:
_logger.LogError(message.ToString());
break;
case LogLevel.Verbose:
_logger.LogTrace(message.ToString());
break;
case LogLevel.Minimal:
_logger.LogTrace(message.ToString());
break;
default:
_logger.LogInformation(message.ToString());
break;
}
}
public override Task LogAsync(ILogMessage message)
{
Log(message);
return Task.CompletedTask;
}
}