Example #1
0
 /// <summary>
 /// Logs the debug format.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="messageFormat">The message format.</param>
 /// <param name="args">The arguments.</param>
 public static void TraceFormat(this ILogger logger, string messageFormat, params object[] args)
 {
     logger?.Log(LogLevel.Trace, messageFormat, args);
 }
Example #2
0
 /// <summary>
 /// Logs the debug.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="exception">The exception.</param>
 /// <param name="messageFormat">The message format.</param>
 /// <param name="args">The arguments.</param>
 public static void Trace(this ILogger logger, Exception exception, string messageFormat, params object[] args)
 {
     logger?.Log(LogLevel.Trace, exception, messageFormat, args);
 }
Example #3
0
 /// <summary>
 /// Logs the debug format.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="messageFormat">The message format.</param>
 /// <param name="args">The arguments.</param>
 public static void Debug(this ILogger logger, string messageFormat, params object[] args)
 {
     logger?.Log(LogLevel.Debug, messageFormat, args);
 }
Example #4
0
 /// <summary>
 /// Logs the information at the provided level.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="level">        The logging level.</param>
 /// <param name="messageFormat">The message format.</param>
 /// <param name="args">         The arguments.</param>
 public static void Log(this ILogger logger, LogLevel level, string messageFormat, params object[] args)
 {
     logger?.Log(level, null, messageFormat, args);
 }
 /// <summary>
 /// Log an event at the Warn severity level, with the specified <paramref name="exception"/> data, <paramref name="message"/>, and <paramref name="source"/>.
 /// </summary>
 /// <param name="logger">The logger interface.</param>
 /// <param name="exception">The exception associated with this event.</param>
 /// <param name="message">The log message; or <see langword="null"/> to use <see cref="Exception.Message"/>.</param>
 /// <param name="source">The source of the event, or <see langword="null"/> to use <see cref="Exception.Source"/>.</param>
 public static void Warn(this ILogger logger, Exception exception, string message = null, string source = null)
 {
     var logMessage = message.Nullable() ?? exception.Message;
     var logSource = source.Nullable() ?? exception.Source;
     logger?.Log(new LogEntry(LogLevel.Warn, logMessage, source, exception));
 }
 /// <summary>
 /// Log an event at the Fatal severity level, with the specified <paramref name="message"/> and <paramref name="source"/>.
 /// </summary>
 /// <param name="logger">The logger interface.</param>
 /// <param name="message">The log message.</param>
 /// <param name="source">The source of the event.</param>
 public static void Fatal(this ILogger logger, string message, string source = null)
 {
     logger?.Log(new LogEntry(LogLevel.Fatal, message, source, null));
 }