using NCC.Dependency; using Microsoft.Extensions.Logging; using System; namespace NCC.Logging.Extensions { /// /// 字符串日志输出拓展 /// [SuppressSniffer] public static class StringLoggingExtensions { /// /// 设置消息格式化参数 /// /// /// public static StringLoggingPart SetArgs(this string message, params object[] args) { return new StringLoggingPart().SetMessage(message).SetArgs(args); } /// /// 设置日志级别 /// /// /// public static StringLoggingPart SetLevel(this string message, LogLevel level) { return new StringLoggingPart().SetMessage(message).SetLevel(level); } /// /// 设置事件 Id /// /// /// public static StringLoggingPart SetEventId(this string message, EventId eventId) { return new StringLoggingPart().SetMessage(message).SetEventId(eventId); } /// /// 设置日志分类 /// /// /// public static StringLoggingPart SetCategory(this string message) { return new StringLoggingPart().SetMessage(message).SetCategory(); } /// /// 设置日志分类名 /// /// /// public static StringLoggingPart SetCategory(this string message, string categoryName) { return new StringLoggingPart().SetMessage(message).SetCategory(categoryName); } /// /// 设置异常对象 /// public static StringLoggingPart SetException(this string message, Exception exception) { return new StringLoggingPart().SetMessage(message).SetException(exception); } /// /// 设置日志服务作用域 /// /// /// /// public static StringLoggingPart SetLoggerScoped(this string message, IServiceProvider serviceProvider) { return new StringLoggingPart().SetMessage(message).SetLoggerScoped(serviceProvider); } /// /// LogInformation /// /// /// public static void LogInformation(this string message, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).LogInformation(); } /// /// LogInformation /// /// /// /// public static void LogInformation(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).LogInformation(); } /// /// LogInformation /// /// /// /// public static void LogInformation(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetException(exception).LogInformation(); } /// /// LogInformation /// /// /// /// /// public static void LogInformation(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogInformation(); } /// /// LogInformation /// /// /// /// public static void LogInformation(this string message, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).LogInformation(); } /// /// LogInformation /// /// /// /// /// public static void LogInformation(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).LogInformation(); } /// /// LogInformation /// /// /// /// /// public static void LogInformation(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetException(exception).LogInformation(); } /// /// LogInformation /// /// /// /// /// /// public static void LogInformation(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogInformation(); } /// /// LogWarning /// /// /// public static void LogWarning(this string message, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).LogWarning(); } /// /// LogWarning /// /// /// /// public static void LogWarning(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).LogWarning(); } /// /// LogWarning /// /// /// /// public static void LogWarning(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetException(exception).LogWarning(); } /// /// LogWarning /// /// /// /// /// public static void LogWarning(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogWarning(); } /// /// LogWarning /// /// /// /// public static void LogWarning(this string message, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).LogWarning(); } /// /// LogWarning /// /// /// /// /// public static void LogWarning(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).LogWarning(); } /// /// LogWarning /// /// /// /// /// public static void LogWarning(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetException(exception).LogWarning(); } /// /// LogWarning /// /// /// /// /// /// public static void LogWarning(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogWarning(); } /// /// LogError /// /// /// public static void LogError(this string message, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).LogError(); } /// /// LogError /// /// /// /// public static void LogError(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).LogError(); } /// /// LogError /// /// /// /// public static void LogError(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetException(exception).LogError(); } /// /// LogError /// /// /// /// /// public static void LogError(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogError(); } /// /// LogError /// /// /// /// public static void LogError(this string message, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).LogError(); } /// /// LogError /// /// /// /// /// public static void LogError(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).LogError(); } /// /// LogError /// /// /// /// /// public static void LogError(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetException(exception).LogError(); } /// /// LogError /// /// /// /// /// /// public static void LogError(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogError(); } /// /// LogDebug /// /// /// public static void LogDebug(this string message, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).LogDebug(); } /// /// LogDebug /// /// /// /// public static void LogDebug(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).LogDebug(); } /// /// LogDebug /// /// /// /// public static void LogDebug(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetException(exception).LogDebug(); } /// /// LogDebug /// /// /// /// /// public static void LogDebug(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogDebug(); } /// /// LogDebug /// /// /// /// public static void LogDebug(this string message, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).LogDebug(); } /// /// LogDebug /// /// /// /// /// public static void LogDebug(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).LogDebug(); } /// /// LogDebug /// /// /// /// /// public static void LogDebug(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetException(exception).LogDebug(); } /// /// LogDebug /// /// /// /// /// /// public static void LogDebug(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogDebug(); } /// /// LogTrace /// /// /// public static void LogTrace(this string message, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).LogTrace(); } /// /// LogTrace /// /// /// /// public static void LogTrace(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).LogTrace(); } /// /// LogTrace /// /// /// /// public static void LogTrace(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetException(exception).LogTrace(); } /// /// LogTrace /// /// /// /// /// public static void LogTrace(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogTrace(); } /// /// LogTrace /// /// /// /// public static void LogTrace(this string message, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).LogTrace(); } /// /// LogTrace /// /// /// /// /// public static void LogTrace(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).LogTrace(); } /// /// LogTrace /// /// /// /// /// public static void LogTrace(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetException(exception).LogTrace(); } /// /// LogTrace /// /// /// /// /// /// public static void LogTrace(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogTrace(); } /// /// LogCritical /// /// /// public static void LogCritical(this string message, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).LogCritical(); } /// /// LogCritical /// /// /// /// public static void LogCritical(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).LogCritical(); } /// /// LogCritical /// /// /// /// public static void LogCritical(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetException(exception).LogCritical(); } /// /// LogCritical /// /// /// /// /// public static void LogCritical(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogCritical(); } /// /// LogCritical /// /// /// /// public static void LogCritical(this string message, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).LogCritical(); } /// /// LogCritical /// /// /// /// /// public static void LogCritical(this string message, EventId eventId, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).LogCritical(); } /// /// LogCritical /// /// /// /// /// public static void LogCritical(this string message, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetException(exception).LogCritical(); } /// /// LogCritical /// /// /// /// /// /// public static void LogCritical(this string message, EventId eventId, Exception exception, params object[] args) { new StringLoggingPart().SetCategory().SetMessage(message).SetArgs(args).SetEventId(eventId).SetException(exception).LogCritical(); } } }