private static void CoreNullCheck(ILogNotifier @this) { if (@this == null) { throw new NullReferenceException("This is null"); } }
public static void CoreLog(ILogNotifier notifier, string message, LogLevel logLevel) { lock (notifier) { notifier.SendNotification(ConsoleMediator.ConsoleLogNotification, message, logLevel.ToString()); } }
/// <summary> /// Log a message at the Debug level /// </summary> /// <param name="this">The ILogNotifier</param> /// <param name="message">The message to send</param> public static void Debug(this ILogNotifier @this, string message) { CoreNullCheck(@this); CoreLog(@this, message, LogLevel.DEBUG); }
/// <summary> /// Log a message at the Verbose level /// </summary> /// <param name="this">The ILogNotifier</param> /// <param name="message">The message to send</param> public static void Verbose(this ILogNotifier @this, string message) { CoreNullCheck(@this); CoreLog(@this, message, LogLevel.VERBOSE); }
/// <summary> /// Log a message at the Info level /// </summary> /// <param name="this">The ILogNotifier</param> /// <param name="message">The message to send</param> public static void Info(this ILogNotifier @this, string message) { CoreNullCheck(@this); CoreLog(@this, message, LogLevel.INFO); }
/// <summary> /// Log a message at the Warning level /// </summary> /// <param name="this">The ILogNotifier</param> /// <param name="message">The message to send</param> public static void Warning(this ILogNotifier @this, string message) { CoreNullCheck(@this); CoreLog(@this, message, LogLevel.WARNING); }
/// <summary> /// Log a message at the Warning level /// </summary> /// <param name="this">The ILogNotifier</param> /// <param name="message">The message to send</param> public static void Critical(this ILogNotifier @this, string message) { CoreNullCheck(@this); CoreLog(@this, message, LogLevel.CRITICAL); }