/// <summary>Logs an error message.</summary>
        /// <param name="source">The source value.</param>
        /// <param name="formatProvider">The format provider.</param>
        /// <param name="format">The message to log.</param>
        /// <param name="arguments">The message arguments.</param>
        /// <returns>The unique log entry ID.</returns>
        public static Guid Critical(this ILogger source, IFormatProvider formatProvider, string format, params object[] arguments)
        {
            var trace = StackTraceExtensions.GetCallerStack();

            return(Critical(source, c => c.Message(formatProvider, format, arguments)
                            .WithStackTrace(trace)));
        }
        /// <summary>Logs an error message.</summary>
        /// <param name="source">The source value.</param>
        /// <param name="format">The message to log.</param>
        /// <param name="arguments">The message arguments.</param>
        /// <returns>The unique log entry ID.</returns>
        public static Guid Error(this ILogger source, string format, params object[] arguments)
        {
            var trace = StackTraceExtensions.GetCallerStack();

            return(Error(source, c => c.Message(format, arguments)
                         .WithStackTrace(trace)));
        }
        /// <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);
        }
        /// <summary>Logs an error message.</summary>
        /// <param name="source">The source value.</param>
        /// <param name="message">The message to log.</param>
        /// <returns>The unique log entry ID.</returns>
        public static Guid Critical(this ILogger source, string message)
        {
            var trace = StackTraceExtensions.GetCallerStack();

            return(Critical(source, c => c.Message(message).WithStackTrace(trace)));
        }