using MediaBrowser.Model.Logging; using System; namespace MediaBrowser.Common.Logging { /// /// Class Logger /// public static class Logger { /// /// Gets or sets the logger instance. /// /// The logger instance. internal static ILogger LoggerInstance { get; set; } /// /// Logs the info. /// /// The message. /// The param list. public static void LogInfo(string message, params object[] paramList) { LogEntry(message, LogSeverity.Info, null, paramList); } /// /// Logs the debug info. /// /// The message. /// The param list. public static void LogDebugInfo(string message, params object[] paramList) { LogEntry(message, LogSeverity.Debug, null, paramList); } /// /// Logs the error. /// /// The message. /// The param list. public static void LogError(string message, params object[] paramList) { LogEntry(message, LogSeverity.Error, null, paramList); } /// /// Logs the exception. /// /// The message. /// The ex. /// The param list. public static void LogException(string message, Exception ex, params object[] paramList) { LogEntry(message, LogSeverity.Error, ex, paramList); } /// /// Fatals the exception. /// /// The message. /// The ex. /// The param list. public static void FatalException(string message, Exception ex, params object[] paramList) { LogEntry(message, LogSeverity.Fatal, ex, paramList); } /// /// Logs the warning. /// /// The message. /// The param list. public static void LogWarning(string message, params object[] paramList) { LogEntry(message, LogSeverity.Warn, null, paramList); } /// /// Logs the entry. /// /// The message. /// The level. /// The exception. /// The param list. private static void LogEntry(string message, LogSeverity level, Exception exception, params object[] paramList) { if (LoggerInstance == null) { return; } if (exception == null) { LoggerInstance.Log(level, message, paramList); } else { if (level == LogSeverity.Fatal) { LoggerInstance.FatalException(message, exception, paramList); } else { LoggerInstance.ErrorException(message, exception, paramList); } } } } }