Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
340d113
commit b1a8863
Showing
3 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace ModuleManager.Logging | ||
{ | ||
// Stripped down version of UnityEngine.ILogger | ||
public interface IBasicLogger | ||
{ | ||
void Log(LogType logType, string message); | ||
void Info(string message); | ||
void Warning(string message); | ||
void Error(string message); | ||
void Exception(string message, Exception exception); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace ModuleManager.Logging | ||
{ | ||
public class ModLogger : IBasicLogger | ||
{ | ||
private string prefix; | ||
private ILogger logger; | ||
|
||
public ModLogger(string prefix, ILogger logger) | ||
{ | ||
this.prefix = "[" + prefix + "] "; | ||
this.logger = logger; | ||
} | ||
|
||
public void Log(LogType logType, string message) => logger.Log(logType, prefix + message); | ||
|
||
public void Info(string message) => Log(LogType.Log, message); | ||
public void Warning(string message) => Log(LogType.Warning, message); | ||
public void Error(string message) => Log(LogType.Error, message); | ||
|
||
public void Exception(string message, Exception exception) | ||
{ | ||
Error(message); | ||
logger.LogException(exception); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters