diff --git a/Logging.cs b/Logging.cs new file mode 100644 index 0000000..a378482 --- /dev/null +++ b/Logging.cs @@ -0,0 +1,50 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace ZelleGames.Log +{ + public enum LogLevel { DEBUG, INFO, WARN, ERROR } + + public static class Logging + { + //static readonly NLog.Logger Logger = NLog.LogManager.GetCurrentClassLogger(); + public static void Init() + { + //var config = new NLog.Config.LoggingConfiguration(); + //var logfile = new NLog.Targets.FileTarget("logfile") { FileName = "log.txt" }; + //var loglevel = (Application.isEditor) ? NLog.LogLevel.Debug : NLog.LogLevel.Info; + //config.AddRule(loglevel, NLog.LogLevel.Fatal, logfile); + + //NLog.LogManager.Configuration = config; + } + + public static void Log(LogLevel level, string message, System.Exception ex) + { + switch (level) + { + case LogLevel.DEBUG: + //Logger.Debug(message); + Debug.Log(message); + break; + case LogLevel.INFO: + //Logger.Info(message); + Debug.Log(message); + break; + case LogLevel.WARN: + Debug.LogWarning(message); + //Logger.Warn(message); + break; + case LogLevel.ERROR: + Debug.LogError(message); + //Logger.Error(ex, message); + break; + } + } + + public static void Log(LogLevel level, string message) + { + Log(level, message, null); + } + } +} \ No newline at end of file