|
@@ -12,39 +12,39 @@ namespace XUnity.AutoTranslator.Plugin.Core
|
|
|
|
|
|
public void Error( Exception e, string message )
|
|
|
{
|
|
|
- Write( $"[XUnity.AutoTranslator][ERROR]: {message}" + Environment.NewLine + e );
|
|
|
+ Log( LogLevel.Error, message + Environment.NewLine + e );
|
|
|
}
|
|
|
|
|
|
public void Error( string message )
|
|
|
{
|
|
|
- Write( $"[XUnity.AutoTranslator][ERROR]: {message}" );
|
|
|
+ Log( LogLevel.Error, message );
|
|
|
}
|
|
|
|
|
|
public void Warn( Exception e, string message )
|
|
|
{
|
|
|
- Write( $"[XUnity.AutoTranslator][WARN]: {message}" + Environment.NewLine + e );
|
|
|
+ Log( LogLevel.Warn, message + Environment.NewLine + e );
|
|
|
}
|
|
|
|
|
|
public void Warn( string message )
|
|
|
{
|
|
|
- Write( $"[XUnity.AutoTranslator][WARN]: {message}" );
|
|
|
+ Log( LogLevel.Warn, message );
|
|
|
}
|
|
|
|
|
|
public void Info( Exception e, string message )
|
|
|
{
|
|
|
- Write( $"[XUnity.AutoTranslator][INFO]: {message}" + Environment.NewLine + e );
|
|
|
+ Log( LogLevel.Info, message + Environment.NewLine + e );
|
|
|
}
|
|
|
|
|
|
public void Info( string message )
|
|
|
{
|
|
|
- Write( $"[XUnity.AutoTranslator][INFO]: {message}" );
|
|
|
+ Log( LogLevel.Info, message );
|
|
|
}
|
|
|
|
|
|
public void Debug( Exception e, string message )
|
|
|
{
|
|
|
if( Settings.EnableDebugLogs )
|
|
|
{
|
|
|
- Write( $"[XUnity.AutoTranslator][DEBUG]: {message}" + Environment.NewLine + e );
|
|
|
+ Log( LogLevel.Debug, message + Environment.NewLine + e );
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -52,10 +52,27 @@ namespace XUnity.AutoTranslator.Plugin.Core
|
|
|
{
|
|
|
if( Settings.EnableDebugLogs )
|
|
|
{
|
|
|
- Write( $"[XUnity.AutoTranslator][DEBUG]: {message}" );
|
|
|
+ Log( LogLevel.Debug, message );
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- protected abstract void Write( string formattedMessage );
|
|
|
+ protected abstract void Log( LogLevel level, string message );
|
|
|
+
|
|
|
+ protected string GetPrefix( LogLevel level )
|
|
|
+ {
|
|
|
+ switch( level )
|
|
|
+ {
|
|
|
+ case LogLevel.Debug:
|
|
|
+ return "[XUnity.AutoTranslator][DEBUG]: ";
|
|
|
+ case LogLevel.Info:
|
|
|
+ return "[XUnity.AutoTranslator][INFO]: ";
|
|
|
+ case LogLevel.Warn:
|
|
|
+ return "[XUnity.AutoTranslator][WARN]: ";
|
|
|
+ case LogLevel.Error:
|
|
|
+ return "[XUnity.AutoTranslator][ERROR]: ";
|
|
|
+ default:
|
|
|
+ return "[XUnity.AutoTranslator][UNKNOW]: ";
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|