|
|
@@ -13,9 +13,10 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static void Verbose(string info, string? filename = null, Exception? exception = null)
|
|
|
+ /// <param name="consoleShow">控制台显示</param>
|
|
|
+ public static void Verbose(string info, string? filename = null, Exception? exception = null, bool consoleShow = true)
|
|
|
{
|
|
|
- logBase.Out(info, Serilog.Events.LogEventLevel.Verbose, filename, exception);
|
|
|
+ logBase.Out(info, Serilog.Events.LogEventLevel.Verbose, filename, exception, consoleShow);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -24,9 +25,11 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static Task VerboseAsync(string info, string? filename = null, Exception? exception = null, CancellationToken? token = null)
|
|
|
+ /// <param name="consoleShow">控制台显示</param>
|
|
|
+ /// <param name="token">令牌</param>
|
|
|
+ public static Task VerboseAsync(string info, string? filename = null, Exception? exception = null, bool consoleShow = true, CancellationToken? token = null)
|
|
|
{
|
|
|
- return Task.Run(() => Verbose(info, filename, exception), token ?? CancellationToken.None);
|
|
|
+ return Task.Run(() => Verbose(info, filename, exception, consoleShow), token ?? CancellationToken.None);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -35,9 +38,10 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static void Debug(string info, string? filename = null, Exception? exception = null)
|
|
|
+ /// <param name="consoleShow">控制台显示</param>
|
|
|
+ public static void Debug(string info, string? filename = null, Exception? exception = null, bool consoleShow = true)
|
|
|
{
|
|
|
- logBase.Out(info, Serilog.Events.LogEventLevel.Debug, filename, exception);
|
|
|
+ logBase.Out(info, Serilog.Events.LogEventLevel.Debug, filename, exception, consoleShow);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -46,9 +50,10 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static Task DebugAsync(string info, string? filename = null, Exception? exception = null, CancellationToken? token = null)
|
|
|
+ /// <param name="token">令牌</param>
|
|
|
+ public static Task DebugAsync(string info, string? filename = null, Exception? exception = null, bool consoleShow = true, CancellationToken? token = null)
|
|
|
{
|
|
|
- return Task.Run(() => Debug(info, filename, exception), token ?? CancellationToken.None);
|
|
|
+ return Task.Run(() => Debug(info, filename, exception, consoleShow), token ?? CancellationToken.None);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -57,9 +62,10 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static void Info(string info, string? filename = null, Exception? exception = null)
|
|
|
+ /// <param name="consoleShow">控制台显示</param>
|
|
|
+ public static void Info(string info, string? filename = null, Exception? exception = null, bool consoleShow = true)
|
|
|
{
|
|
|
- logBase.Out(info, Serilog.Events.LogEventLevel.Information, filename, exception);
|
|
|
+ logBase.Out(info, Serilog.Events.LogEventLevel.Information, filename, exception, consoleShow);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -68,9 +74,11 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static Task InfoAsync(string info, string? filename = null, Exception? exception = null, CancellationToken? token = null)
|
|
|
+ /// <param name="consoleShow">控制台显示</param>
|
|
|
+ /// <param name="token">令牌</param>
|
|
|
+ public static Task InfoAsync(string info, string? filename = null, Exception? exception = null, bool consoleShow = true, CancellationToken? token = null)
|
|
|
{
|
|
|
- return Task.Run(() => Info(info, filename, exception), token ?? CancellationToken.None);
|
|
|
+ return Task.Run(() => Info(info, filename, exception, consoleShow), token ?? CancellationToken.None);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -79,9 +87,10 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static void Warning(string info, string? filename = null, Exception? exception = null)
|
|
|
+ /// <param name="consoleShow">控制台显示</param>
|
|
|
+ public static void Warning(string info, string? filename = null, Exception? exception = null, bool consoleShow = true)
|
|
|
{
|
|
|
- logBase.Out(info, Serilog.Events.LogEventLevel.Warning, filename, exception);
|
|
|
+ logBase.Out(info, Serilog.Events.LogEventLevel.Warning, filename, exception, consoleShow);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -90,9 +99,11 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static Task WarningAsync(string info, string? filename = null, Exception? exception = null, CancellationToken? token = null)
|
|
|
+ /// <param name="consoleShow">控制台显示</param>
|
|
|
+ /// <param name="token">令牌</param>
|
|
|
+ public static Task WarningAsync(string info, string? filename = null, Exception? exception = null, bool consoleShow = true, CancellationToken? token = null)
|
|
|
{
|
|
|
- return Task.Run(() => Warning(info, filename, exception), token ?? CancellationToken.None);
|
|
|
+ return Task.Run(() => Warning(info, filename, exception, consoleShow), token ?? CancellationToken.None);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -101,9 +112,10 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static void Error(string info, string? filename = null, Exception? exception = null)
|
|
|
+ /// <param name="consoleShow">控制台显示</param>
|
|
|
+ public static void Error(string info, string? filename = null, Exception? exception = null, bool consoleShow = true)
|
|
|
{
|
|
|
- logBase.Out(info, Serilog.Events.LogEventLevel.Error, filename, exception);
|
|
|
+ logBase.Out(info, Serilog.Events.LogEventLevel.Error, filename, exception, consoleShow);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -112,9 +124,11 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static Task ErrorAsync(string info, string? filename = null, Exception? exception = null, CancellationToken? token = null)
|
|
|
+ /// <param name="consoleShow">控制台显示</param>
|
|
|
+ /// <param name="token">令牌</param>
|
|
|
+ public static Task ErrorAsync(string info, string? filename = null, Exception? exception = null, bool consoleShow = true, CancellationToken? token = null)
|
|
|
{
|
|
|
- return Task.Run(() => Error(info, filename, exception), token ?? CancellationToken.None);
|
|
|
+ return Task.Run(() => Error(info, filename, exception, consoleShow), token ?? CancellationToken.None);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -123,9 +137,10 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static void Fatal(string info, string? filename = null, Exception? exception = null)
|
|
|
+ /// <param name="consoleShow">控制台显示</param>
|
|
|
+ public static void Fatal(string info, string? filename = null, Exception? exception = null, bool consoleShow = true)
|
|
|
{
|
|
|
- logBase.Out(info, Serilog.Events.LogEventLevel.Fatal, filename, exception);
|
|
|
+ logBase.Out(info, Serilog.Events.LogEventLevel.Fatal, filename, exception, consoleShow);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -134,9 +149,11 @@
|
|
|
/// <param name="info">信息</param>
|
|
|
/// <param name="filename">文件名</param>
|
|
|
/// <param name="exception">异常对象</param>
|
|
|
- public static Task FatalAsync(string info, string? filename = null, Exception? exception = null, CancellationToken? token = null)
|
|
|
+ /// <param name="consoleShow">控制台显示</param>
|
|
|
+ /// <param name="token">令牌</param>
|
|
|
+ public static Task FatalAsync(string info, string? filename = null, Exception? exception = null, bool consoleShow = true, CancellationToken? token = null)
|
|
|
{
|
|
|
- return Task.Run(() => Fatal(info, filename, exception), token ?? CancellationToken.None);
|
|
|
+ return Task.Run(() => Fatal(info, filename, exception, consoleShow), token ?? CancellationToken.None);
|
|
|
}
|
|
|
}
|
|
|
}
|