Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Why not just keep track of it and add it yourself?</p> <p>Something like:</p> <pre><code>public static class LoggingWrapper { private static ILog logger; private DateTime timeOfLastLog; static LoggingWrapper() { logger = LogManager.GetLogger(typeof(Program)); logger.Info("Logger initialized"); timeOfLastLog = DateTime.Now; } public static void Debug(string Message) { logger = LogManager.GetLogger("YourDebugLoggerName"); TimeSpan differential = DateTime.Now - timeOfLastLog(); logger.Debug(Message + "-----" + differential.ToString()); } } </code></pre> <p>Obviously youd want to customize a bit, but this is the basic idea. I always use a wrapper class to do logging, just because it adds customization capabilities. For example, I use it to do custom exception logging like this:</p> <pre><code>public static void LogException(Exception ex) { logger = LogManager.GetLogger("NHibernate.SQL"); logger.Error(ex.Message + Environment.NewLine + ex.InnerException + Environment.NewLine + ex.StackTrace, ex); } </code></pre> <p>That way, when I want to log exception details, I can do something like:</p> <pre><code>try { ThrowAnException(); } catch(Exception ex) { LoggingWrapper.LogException(ex); } </code></pre> <p>instead of:</p> <pre><code>try { ThrowAnException(); } catch(Exception ex) { LoggingWrapper.Error(ex.Message + Environment.NewLine + ex.InnerException + Environment.NewLine + ex.StackTrace); } </code></pre> <p>And that's just one example. There are quite a few other things that make this useful.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload