/// <summary>Logs a warning message.</summary> /// <param name="source">The source value.</param> /// <param name="action">The action to configure the builder.</param> /// <returns>The unique log entry ID.</returns> public static Guid Warning(this ILogger source, Action <LogEntryBuilder> action) { var builder = new LogEntryBuilder().Level(LogLevel.Warning); action(builder); var entry = builder.ToLogEntry(); source.LogEntry(entry); return(entry.Id); }
/// <summary>Logs an error message.</summary> /// <param name="source">The source value.</param> /// <param name="action">The action to configure the log entry.</param> /// <returns>The unique log entry ID.</returns> public static Guid Critical(this ILogger source, Action <LogEntryBuilder> action) { var builder = new LogEntryBuilder().Level(LogLevel.Critical); action(builder); if (!builder.HasStackTrace) { var trace = StackTraceExtensions.GetCallerStack(); builder.WithStackTrace(trace); } ; var entry = builder.ToLogEntry(); source.LogEntry(entry); return(entry.Id); }