diff --git a/src/ExchangeSharp/Utility/Logger.cs b/src/ExchangeSharp/Utility/Logger.cs index 4359748a..9aeb25e8 100644 --- a/src/ExchangeSharp/Utility/Logger.cs +++ b/src/ExchangeSharp/Utility/Logger.cs @@ -1,4 +1,4 @@ -/* +/* MIT LICENSE Copyright 2017 Digital Ruby, LLC - http://www.digitalruby.com @@ -94,6 +94,13 @@ public enum LogLevel None = Off } + public class LoggerEvent + { + public LogLevel level; + public string text; + public object[] args; + } + /// /// ExchangeSharp logger. Will never throw exceptions. /// Currently the ExchangeSharp logger uses NLog internally, so make sure it is setup in your app.config file or nlog.config file. @@ -101,6 +108,7 @@ public enum LogLevel public static class Logger { private static readonly NLog.Logger logger; + public static event Action LogWrite; static Logger() { @@ -253,6 +261,7 @@ public static void Write(LogLevel level, string text, params object[] args) text = string.Format(text, args); } logger?.Log(GetNLogLevel(level), text); + LogWrite?.Invoke(new LoggerEvent() { level = level, text = text, args = args }); } catch {