/[RomCheater]/trunk/RomCheater.Logging/logger.cs
ViewVC logotype

Diff of /trunk/RomCheater.Logging/logger.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 685 by william, Mon Jun 17 08:58:58 2013 UTC revision 692 by william, Mon Jun 17 10:29:30 2013 UTC
# Line 59  namespace RomCheater.Logging Line 59  namespace RomCheater.Logging
59              add_dict_entry(ERROR);              add_dict_entry(ERROR);
60              add_dict_entry(VERBOSE_DEBUG);              add_dict_entry(VERBOSE_DEBUG);
61              add_dict_entry(VERBOSE_ERROR);              add_dict_entry(VERBOSE_ERROR);
62                add_dict_entry(WARN);
63                add_dict_entry(PROFILER);
64              add_dict_entry(DEFAULT);              add_dict_entry(DEFAULT);
65              add_dict_entry(ALL);              add_dict_entry(ALL);
66          }          }
# Line 145  namespace RomCheater.Logging Line 147  namespace RomCheater.Logging
147          public static EnumNameValuePair<TValue> VERBOSE_ERROR = new EnumNameValuePair<TValue>("VERBOSE_ERROR", Binary<TValue>.ToValue("10000"));          public static EnumNameValuePair<TValue> VERBOSE_ERROR = new EnumNameValuePair<TValue>("VERBOSE_ERROR", Binary<TValue>.ToValue("10000"));
148          public static EnumNameValuePair<TValue> WARN = new EnumNameValuePair<TValue>("WARN", Binary<TValue>.ToValue("100000"));          public static EnumNameValuePair<TValue> WARN = new EnumNameValuePair<TValue>("WARN", Binary<TValue>.ToValue("100000"));
149          public static EnumNameValuePair<TValue> PROFILER = new EnumNameValuePair<TValue>("PROFILER", Binary<TValue>.ToValue("1000000"));          public static EnumNameValuePair<TValue> PROFILER = new EnumNameValuePair<TValue>("PROFILER", Binary<TValue>.ToValue("1000000"));
150          public static EnumNameValuePair<TValue> DEFAULT = new EnumNameValuePair<TValue>("DEFAULT", EnumNameValuePair<TValue>.bitwise_or(INFO, DEBUG, ERROR, WARN));          public static EnumNameValuePair<TValue> DEFAULT = new EnumNameValuePair<TValue>("DEFAULT", EnumNameValuePair<TValue>.bitwise_or(INFO, ERROR, WARN));
151          public static EnumNameValuePair<TValue> ALL = new EnumNameValuePair<TValue>("ALL", EnumNameValuePair<TValue>.bitwise_or(DEFAULT, VERBOSE_DEBUG, VERBOSE_ERROR, PROFILER));          public static EnumNameValuePair<TValue> ALL = new EnumNameValuePair<TValue>("ALL", EnumNameValuePair<TValue>.bitwise_or(DEFAULT,DEBUG, VERBOSE_DEBUG, VERBOSE_ERROR, PROFILER));
152          #endregion          #endregion
153    
154          protected static Dictionary<TValue, EnumNameValuePair<TValue>> value_pairs;          protected static Dictionary<TValue, EnumNameValuePair<TValue>> value_pairs;
# Line 271  namespace RomCheater.Logging Line 273  namespace RomCheater.Logging
273          public static class Info          public static class Info
274          {          {
275              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(INFO) " + GetLoggingClass() + " " + format; }              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(INFO) " + GetLoggingClass() + " " + format; }
276              [Conditional("LOGGING_ENABLE_INFO")]              //[Conditional("LOGGING_ENABLE_INFO")]
277              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.INFO)) { xlogger.Write(CreateNewFormat(format), args); } }              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.INFO)) { xlogger.Write(CreateNewFormat(format), args); } }
278              [Conditional("LOGGING_ENABLE_INFO")]              //[Conditional("LOGGING_ENABLE_INFO")]
279              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.INFO)) { xlogger.WriteLine(CreateNewFormat(format), args); } }              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.INFO)) { xlogger.WriteLine(CreateNewFormat(format), args); } }
280          }          }
281          public static class Warn          public static class Warn
282          {          {
283              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(WARN) " + GetLoggingClass() + " " + format; }              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(WARN) " + GetLoggingClass() + " " + format; }
284              [Conditional("LOGGING_ENABLE_WARN")]              //[Conditional("LOGGING_ENABLE_WARN")]
285              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.WARN)) { xlogger.Write(CreateNewFormat(format), args); } }              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.WARN)) { xlogger.Write(CreateNewFormat(format), args); } }
286              [Conditional("LOGGING_ENABLE_WARN")]              //[Conditional("LOGGING_ENABLE_WARN")]
287              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.WARN)) { xlogger.WriteLine(CreateNewFormat(format), args); } }              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.WARN)) { xlogger.WriteLine(CreateNewFormat(format), args); } }
288          }          }
289          public static class Debug          public static class Debug
290          {          {
291              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(DEBUG) " + GetLoggingClass() + " " + format; }              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(DEBUG) " + GetLoggingClass() + " " + format; }
292              [Conditional("LOGGING_ENABLE_DEBUG")]              //[Conditional("LOGGING_ENABLE_DEBUG")]
293              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.DEBUG)) { xlogger.Write(CreateNewFormat(format), args); } }              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.DEBUG)) { xlogger.Write(CreateNewFormat(format), args); } }
294              [Conditional("LOGGING_ENABLE_DEBUG")]              //[Conditional("LOGGING_ENABLE_DEBUG")]
295              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.DEBUG)) { xlogger.WriteLine(CreateNewFormat(format), args); } }              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.DEBUG)) { xlogger.WriteLine(CreateNewFormat(format), args); } }
296          }          }
297          public static class VerboseDebug          public static class VerboseDebug
298          {          {
299              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(VERBOSE DEBUG) " + GetLoggingClass() + " " + format; }              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(VERBOSE DEBUG) " + GetLoggingClass() + " " + format; }
300              [Conditional("LOGGING_ENABLE_VERBOSEDEBUG")]              //[Conditional("LOGGING_ENABLE_VERBOSEDEBUG")]
301              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_DEBUG)) { xlogger.Write(CreateNewFormat(format), args); } }              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_DEBUG)) { xlogger.Write(CreateNewFormat(format), args); } }
302              [Conditional("LOGGING_ENABLE_VERBOSEDEBUG")]              //[Conditional("LOGGING_ENABLE_VERBOSEDEBUG")]
303    
304              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_DEBUG)) { xlogger.WriteLine(CreateNewFormat(format), args); } }              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_DEBUG)) { xlogger.WriteLine(CreateNewFormat(format), args); } }
305          }          }
306          public static class Error          public static class Error
307          {          {
308              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(ERROR) " + GetLoggingClass() + " " + format; }              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(ERROR) " + GetLoggingClass() + " " + format; }
309              [Conditional("LOGGING_ENABLE_ERROR")]              //[Conditional("LOGGING_ENABLE_ERROR")]
310              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.ERROR)) { xlogger.Write(CreateNewFormat(format), args); } }              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.ERROR)) { xlogger.Write(CreateNewFormat(format), args); } }
311              [Conditional("LOGGING_ENABLE_ERROR")]              //[Conditional("LOGGING_ENABLE_ERROR")]
312              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.ERROR)) { xlogger.WriteLine(CreateNewFormat(format), args); } }              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.ERROR)) { xlogger.WriteLine(CreateNewFormat(format), args); } }
313          }          }
314          public static class VerboseError          public static class VerboseError
315          {          {
316              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(VERBOSE ERROR) " + GetLoggingClass() + " " + format; }              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(VERBOSE ERROR) " + GetLoggingClass() + " " + format; }
317              [Conditional("LOGGING_ENABLE_VERBOSEERROR")]              //[Conditional("LOGGING_ENABLE_VERBOSEERROR")]
318              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_ERROR)) { xlogger.Write(CreateNewFormat(format), args); } }              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_ERROR)) { xlogger.Write(CreateNewFormat(format), args); } }
319              [Conditional("LOGGING_ENABLE_VERBOSEERROR")]              //[Conditional("LOGGING_ENABLE_VERBOSEERROR")]
320              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_ERROR)) { xlogger.WriteLine(CreateNewFormat(format), args); } }              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.VERBOSE_ERROR)) { xlogger.WriteLine(CreateNewFormat(format), args); } }
321          }          }
322          public static class Profiler          public static class Profiler
323          {          {
324              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(PROFILER) " + GetLoggingClass() + " " + format; }              private static string CreateNewFormat(string format) { return "    " + CreateTimeStamp() + "(PROFILER) " + GetLoggingClass() + " " + format; }
325              [Conditional("LOGGING_ENABLE_PROFILER")]              //[Conditional("LOGGING_ENABLE_PROFILER")]
326              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.PROFILER)) { xlogger.Write(CreateNewFormat(format), args); } }              public static void Write(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.PROFILER)) { xlogger.Write(CreateNewFormat(format), args); } }
327              [Conditional("LOGGING_ENABLE_PROFILER")]              //[Conditional("LOGGING_ENABLE_PROFILER")]
328              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.PROFILER)) { xlogger.WriteLine(CreateNewFormat(format), args); } }              public static void WriteLine(string format, params object[] args) { if (logging_flags.HasFlag(loggerflags.PROFILER)) { xlogger.WriteLine(CreateNewFormat(format), args); } }
329          }          }
330          #region Force logging          #region Force logging
# Line 372  namespace RomCheater.Logging Line 374  namespace RomCheater.Logging
374          static xlogger() { lh = new logwriter(); }          static xlogger() { lh = new logwriter(); }
375    
376          #region ILogger Members          #region ILogger Members
377          [Conditional("LOGGING_ENABLED")]          //[Conditional("LOGGING_ENABLED")]
378          public static void Write(string format, params object[] args)          public static void Write(string format, params object[] args)
379          {          {
380              init();              init();
381              lh.Write(format, args);              lh.Write(format, args);
382          }          }
383          [Conditional("LOGGING_ENABLED")]          //[Conditional("LOGGING_ENABLED")]
384          public static void WriteLine(string format, params object[] args)          public static void WriteLine(string format, params object[] args)
385          {          {
386              init();              init();
# Line 431  namespace RomCheater.Logging Line 433  namespace RomCheater.Logging
433              this.writer = writer;              this.writer = writer;
434          }          }
435          #region ILogger Members          #region ILogger Members
436           [Conditional("LOGGING_ENABLED")]           //[Conditional("LOGGING_ENABLED")]
437          public void Write(string format, params object[] args)          public void Write(string format, params object[] args)
438          {          {
439              WriteToLog(format, false, args);              WriteToLog(format, false, args);
440          }          }
441           [Conditional("LOGGING_ENABLED")]           //[Conditional("LOGGING_ENABLED")]
442          public void WriteLine(string format, params object[] args)          public void WriteLine(string format, params object[] args)
443          {          {
444              WriteToLog(format, true, args);              WriteToLog(format, true, args);

Legend:
Removed from v.685  
changed lines
  Added in v.692

  ViewVC Help
Powered by ViewVC 1.1.22