forked from sarbian/ModuleManager
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIBasicLoggerExtensions.cs
More file actions
26 lines (23 loc) · 1.19 KB
/
Copy pathIBasicLoggerExtensions.cs
File metadata and controls
26 lines (23 loc) · 1.19 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
using System;
using UnityEngine;
using ModuleManager.Logging;
namespace ModuleManager.Extensions
{
public static class IBasicLoggerExtensions
{
public static void Info(this IBasicLogger logger, string message) => logger.Log(new LogMessage(LogType.Log, message));
public static void Warning(this IBasicLogger logger, string message) => logger.Log(new LogMessage(LogType.Warning, message));
public static void Error(this IBasicLogger logger, string message) => logger.Log(new LogMessage(LogType.Error, message));
public static void Exception(this IBasicLogger logger, Exception exception)
{
if (exception == null) throw new ArgumentNullException(nameof(exception));
logger.Log(new LogMessage(LogType.Exception, exception.ToString()));
}
public static void Exception(this IBasicLogger logger, string message, Exception exception)
{
if (message == null) throw new ArgumentNullException(nameof(message));
if (exception == null) throw new ArgumentNullException(nameof(exception));
logger.Log(new LogMessage(LogType.Exception, message + ": " + exception.ToString()));
}
}
}