-
Notifications
You must be signed in to change notification settings - Fork 66
/
LoggerExtensions.cs
28 lines (24 loc) · 954 Bytes
/
LoggerExtensions.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
using System.Runtime.CompilerServices;
using MediaBrowser.Model.Logging;
namespace Emby.Plugins.Douban
{
public static class LoggerExtensions
{
public static void LogCallerInfo(this ILogger logger, string message, [CallerMemberName] string caller = null)
{
Log(logger, LogSeverity.Info, caller, message);
}
public static void LogCallerWarning(this ILogger logger, string message, [CallerMemberName] string caller = null)
{
Log(logger, LogSeverity.Warn, caller, message);
}
public static void LogCallerError(this ILogger logger, string message, [CallerMemberName] string caller = null)
{
Log(logger, LogSeverity.Error, caller, message);
}
private static void Log(ILogger logger, LogSeverity logSeverity, string caller, string message)
{
logger.Log(logSeverity, $"[{caller}] {message}");
}
}
}