Guest User

Untitled

a guest
Jun 24th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. //obviously not thread safe and lots of other things. But this illustrates the point that
  2. //Dispatcher can be stubbed and tested against to ensure a log entry was made.
  3.    public static class Logger
  4.    {
  5.       public static ILoggerDispatcher Dispatcher { get; set; }
  6.  
  7.       public static void Log(string message, Exception exception)
  8.       {
  9.          if (Dispatcher != null)
  10.          {
  11.             Dispatcher.Log(message, exception);
  12.          }
  13.       }
  14.  
  15.       public static void Log(LogLevel level, string message)
  16.       {
  17.          if (Dispatcher != null)
  18.          {
  19.             Dispatcher.Log(message);
  20.          }
  21.       }
  22.    }
Add Comment
Please, Sign In to add comment