--- trunk/RomCheater.Logging/logger.cs 2012/05/09 10:05:28 28 +++ trunk/RomCheater.Logging/logger.cs 2012/05/09 22:37:17 95 @@ -22,8 +22,8 @@ namespace RomCheater.Logging INFO = 0x0001, // 001 DEBUG = 0x0002, // 010 ERROR= 0x0004, // 100 - DEFAULT = INFO | ERROR, - ALL = 0x07, + DEFAULT = INFO | ERROR | DEBUG, + ALL = DEFAULT, } public static class logger { @@ -56,6 +56,29 @@ namespace RomCheater.Logging public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.ERROR)) { xlogger.Write(CreateNewFormat(format), args); } } public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.ERROR)) { xlogger.WriteLine(CreateNewFormat(format), args); } } } + #region Force logging + public static class ForceLog + { + public static class Info + { + private static string CreateNewFormat(string format) { return " " + CreateTimeStamp() + "(INFO) " + format; } + public static void Write(string format, params object[] args) { xlogger.Write(CreateNewFormat(format), args); } + public static void WriteLine(string format, params object[] args) { xlogger.WriteLine(CreateNewFormat(format), args); } + } + public static class Debug + { + private static string CreateNewFormat(string format) { return " " + CreateTimeStamp() + "(DEBUG) " + format; } + public static void Write(string format, params object[] args) { xlogger.Write(CreateNewFormat(format), args); } + public static void WriteLine(string format, params object[] args) { xlogger.WriteLine(CreateNewFormat(format), args); } + } + public static class Error + { + private static string CreateNewFormat(string format) { return " " + CreateTimeStamp() + "(ERROR) " + format; } + public static void Write(string format, params object[] args) { xlogger.Write(CreateNewFormat(format), args); } + public static void WriteLine(string format, params object[] args) { xlogger.WriteLine(CreateNewFormat(format), args); } + } + } + #endregion #endregion } @@ -99,6 +122,7 @@ namespace RomCheater.Logging try { lw = (LogWriter)prop.GetValue(null, null); + lh = new logwriter(lw); break; } catch (Exception) @@ -106,9 +130,7 @@ namespace RomCheater.Logging throw; } } - } - lh = new logwriter(lw); - break; + } } } }