Fast.Logging 公开 API
目标 net8.0;net9.0;net10.0。本页为语法声明与 XML 注释参考,运行示例和边界见模块用法。
源码提交:43554c07f6c216f80b509bd535c0a5b66ae7f2e8。维护流程:scripts/export-dotnet-api.ps1;普通站点构建直接消费此文件。
Fast.Logging.LogContext
源码 · 目标:net8.0、net9.0、net10.0
[SuppressSniffer]
public sealed class LogContext日志上下文
Fast.Logging.LogContext.LogContext
源码 · 目标:net8.0、net9.0、net10.0
public LogContext()初始化类的新实例
Fast.Logging.LogContext.Properties
源码 · 目标:net8.0、net9.0、net10.0
public IDictionary<object, object> Properties { get; set; }日志上下文数据
Fast.Logging.LogMessage
源码 · 目标:net8.0、net9.0、net10.0
[SuppressSniffer]
public struct LogMessage日志结构化消息
Fast.Logging.LogMessage.LogMessage
源码 · 目标:net8.0、net9.0、net10.0
public LogMessage(string logName, LogLevel logLevel, EventId? eventId, string message, Exception exception,
LogContext context, object state, DateTime logDateTime, int threadId, bool useUtcTimestamp, string traceId)初始化类的新实例
- 参数
logName:日志分类名称 - 参数
logLevel:日志级别 - 参数
eventId:日志事件标识 - 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
context:当前日志上下文 - 参数
state:当前状态值 - 参数
logDateTime:日志记录时间 - 参数
threadId:thread 的唯一标识 - 参数
useUtcTimestamp:是否使用 UTC 时间记录日志 - 参数
traceId:trace 的唯一标识
Fast.Logging.LogMessage.LogName
源码 · 目标:net8.0、net9.0、net10.0
public string LogName { get; }记录器类别名称
Fast.Logging.LogMessage.LogLevel
源码 · 目标:net8.0、net9.0、net10.0
public LogLevel LogLevel { get; }日志级别
Fast.Logging.LogMessage.EventId
源码 · 目标:net8.0、net9.0、net10.0
public EventId? EventId { get; }事件Id
Fast.Logging.LogMessage.Message
源码 · 目标:net8.0、net9.0、net10.0
public string Message { get; internal set; }日志消息
Fast.Logging.LogMessage.Exception
源码 · 目标:net8.0、net9.0、net10.0
public Exception Exception { get; }异常对象
Fast.Logging.LogMessage.State
源码 · 目标:net8.0、net9.0、net10.0
public object State { get; }当前状态值
说明:可以是任意类型
Fast.Logging.LogMessage.LogDateTime
源码 · 目标:net8.0、net9.0、net10.0
public DateTime LogDateTime { get; }日志记录时间
Fast.Logging.LogMessage.ThreadId
源码 · 目标:net8.0、net9.0、net10.0
public int ThreadId { get; }线程Id
Fast.Logging.LogMessage.UseUtcTimestamp
源码 · 目标:net8.0、net9.0、net10.0
public bool UseUtcTimestamp { get; }是否使用 UTC 时间戳
Fast.Logging.LogMessage.TraceId
源码 · 目标:net8.0、net9.0、net10.0
public string TraceId { get; }请求/跟踪Id
Fast.Logging.LogMessage.Context
源码 · 目标:net8.0、net9.0、net10.0
public LogContext Context { get; set; }日志上下文
Fast.Logging.LogMessage.ToString
源码 · 目标:net8.0、net9.0、net10.0
public readonly override string ToString()说明继承自接口或基类,需结合对应声明阅读。
Fast.Logging.LoggingContext
源码 · 目标:net8.0、net9.0、net10.0
[SuppressSniffer]
public static class LoggingContext日志上下文
Fast.Logging.LoggingContext.OutputStandardMessage
源码 · 目标:net8.0、net9.0、net10.0
public static string OutputStandardMessage(LogMessage logMsg, string dateFormat = "yyyy-MM-dd HH:mm:ss.fffffff zzz dddd",
bool isConsole = false, bool disableColors = true, bool withTraceId = false, bool withStackFrame = false)输出标准日志消息
- 参数
logMsg:要格式化或输出的日志消息 - 参数
dateFormat:日期时间格式字符串 - 参数
isConsole:日志是否写入控制台 - 参数
disableColors:是否禁用控制台日志颜色 - 参数
withTraceId:with Trace 的唯一标识 - 参数
withStackFrame:是否在日志中包含调用堆栈位置 - 返回:输出标准日志消息
Fast.Logging.LoggingContext.GetLogLevelString
源码 · 目标:net8.0、net9.0、net10.0
public static string GetLogLevelString(LogLevel logLevel)获取日志级别短名称
- 参数
logLevel:日志级别 - 返回:获取到的日志级别短名称
Fast.Logging.IServiceCollectionExtension
源码 · 目标:net8.0、net9.0、net10.0
[SuppressSniffer]
public static class IServiceCollectionExtension为 IServiceCollection 提供动态 API 扩展方法
Fast.Logging.IServiceCollectionExtension.AddLoggingService
源码 · 目标:net8.0、net9.0、net10.0
public static IServiceCollection AddLoggingService(this IServiceCollection services, IConfiguration configuration,
string section = "Logging:Fast")注册日志服务
- 参数
services:要添加服务的服务集合 - 参数
configuration:用于读取模块设置的配置 - 参数
section:JSON 配置文件节点的 Key 默认值:Logging:Fast - 返回:返回
services,便于链式调用
Fast.Logging.LogContextExtension
源码 · 目标:net8.0、net9.0、net10.0
[SuppressSniffer]
public static class LogContextExtensionLogContext 扩展
Fast.Logging.LogContextExtension.Set
源码 · 目标:net8.0、net9.0、net10.0
public static LogContext Set(this LogContext logContext, object key, object value)设置上下文数据
- 参数
logContext:当前日志上下文 - 参数
key:日志上下文属性键 - 参数
value:要写入日志上下文的属性值 - 返回:设置上下文数据
Fast.Logging.LogContextExtension.SetRange
源码 · 目标:net8.0、net9.0、net10.0
public static LogContext SetRange(this LogContext logContext, IDictionary<object, object> properties)批量设置上下文数据
- 参数
logContext:当前日志上下文 - 参数
properties:要写入上下文的属性集合 - 返回:批量设置上下文数据
Fast.Logging.LogContextExtension.Get
源码 · 目标:net8.0、net9.0、net10.0
public static object Get(this LogContext logContext, object key)获取上下文数据
- 参数
logContext:当前日志上下文 - 参数
key:日志上下文属性键 - 返回:获取到的上下文数据
Fast.Logging.LogContextExtension.Get
源码 · 目标:net8.0、net9.0、net10.0
public static object Get<T>(this LogContext logContext, object key)获取上下文数据
- 参数
logContext:当前日志上下文 - 参数
key:日志上下文属性键 - 类型参数
T:上下文属性值的目标类型 - 返回:获取到的上下文数据
Fast.Logging.LogMessageExtension
源码 · 目标:net8.0、net9.0、net10.0
[SuppressSniffer]
public static class LogMessageExtensionLogMessage 扩展
Fast.Logging.LogMessageExtension.Write
源码 · 目标:net8.0、net9.0、net10.0
public static string Write(this LogMessage _, Action<Utf8JsonWriter> writeAction, bool writeIndented = false)高性能创建 JSON 对象字符串
- 参数
_:扩展方法接收者;该值不参与输出 - 参数
writeAction:向 JSON 写入器填充属性的委托 - 参数
writeIndented:是否格式化输出 JSON - 返回:高性能创建 JSON 对象字符串
Fast.Logging.LogMessageExtension.WriteArray
源码 · 目标:net8.0、net9.0、net10.0
public static string WriteArray(this LogMessage logMsg, Action<Utf8JsonWriter> writeAction, bool writeIndented = false)高性能创建 JSON 数组字符串
- 参数
logMsg:要格式化或输出的日志消息 - 参数
writeAction:向 JSON 写入器填充属性的委托 - 参数
writeIndented:是否格式化输出 JSON - 返回:高性能创建 JSON 数组字符串
Fast.Logging.Log
源码 · 目标:net8.0、net9.0、net10.0
[SuppressSniffer]
public static class Log全局日志静态类
Fast.Logging.Log.Default
源码 · 目标:net8.0、net9.0、net10.0
public static StringLoggingPart Default()手动构建方式
- 返回:手动构建方式
Fast.Logging.Log.CreateLogger
源码 · 目标:net8.0、net9.0、net10.0
public static ILogger CreateLogger<T>()创建日志记录器
- 类型参数
T:日志记录器使用的分类类型 - 返回:创建的日志记录器
Fast.Logging.Log.CreateLoggerFactory
源码 · 目标:net8.0、net9.0、net10.0
public static ILoggerFactory CreateLoggerFactory(Action<ILoggingBuilder> configure = null)创建日志工厂
说明:ILoggerFactory 实现了 IDisposable 接口,注意使用 using 控制
- 参数
configure:日志构建配置操作 - 返回:创建的日志工厂
Fast.Logging.Log.ScopeContext
源码 · 目标:net8.0、net9.0、net10.0
public static (ILogger logger, IDisposable scope) ScopeContext(IDictionary<object, object> properties)创建包含指定属性的日志作用域
- 参数
properties:要加入日志作用域的属性;并发修改时应使用System.Collections.Concurrent.ConcurrentDictionary{TKey,TValue} - 返回:日志记录器以及用于结束作用域的释放句柄
Fast.Logging.Log.ScopeContext
源码 · 目标:net8.0、net9.0、net10.0
public static (ILogger logger, IDisposable scope) ScopeContext(Action<LogContext> configure)创建包含指定属性的日志作用域
- 参数
configure:日志上下文配置操作 - 返回:日志记录器以及用于结束作用域的释放句柄
Fast.Logging.Log.ScopeContext
源码 · 目标:net8.0、net9.0、net10.0
public static (ILogger logger, IDisposable scope) ScopeContext(LogContext context)创建包含指定属性的日志作用域
- 参数
context:当前日志上下文 - 返回:日志记录器以及用于结束作用域的释放句柄
Fast.Logging.Log.Information
源码 · 目标:net8.0、net9.0、net10.0
public static void Information(string message, params object[] args)写入 LogLevel.Information 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Information
源码 · 目标:net8.0、net9.0、net10.0
public static void Information(string message, EventId eventId, params object[] args)写入 LogLevel.Information 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Information
源码 · 目标:net8.0、net9.0、net10.0
public static void Information(string message, Exception exception, params object[] args)写入 LogLevel.Information 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Information
源码 · 目标:net8.0、net9.0、net10.0
public static void Information(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Information 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Information
源码 · 目标:net8.0、net9.0、net10.0
public static void Information<TClass>(string message, params object[] args)写入 LogLevel.Information 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Information
源码 · 目标:net8.0、net9.0、net10.0
public static void Information<TClass>(string message, EventId eventId, params object[] args)写入 LogLevel.Information 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Information
源码 · 目标:net8.0、net9.0、net10.0
public static void Information<TClass>(string message, Exception exception, params object[] args)写入 LogLevel.Information 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Information
源码 · 目标:net8.0、net9.0、net10.0
public static void Information<TClass>(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Information 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Warning
源码 · 目标:net8.0、net9.0、net10.0
public static void Warning(string message, params object[] args)写入 LogLevel.Warning 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Warning
源码 · 目标:net8.0、net9.0、net10.0
public static void Warning(string message, EventId eventId, params object[] args)写入 LogLevel.Warning 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Warning
源码 · 目标:net8.0、net9.0、net10.0
public static void Warning(string message, Exception exception, params object[] args)写入 LogLevel.Warning 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Warning
源码 · 目标:net8.0、net9.0、net10.0
public static void Warning(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Warning 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Warning
源码 · 目标:net8.0、net9.0、net10.0
public static void Warning<TClass>(string message, params object[] args)写入 LogLevel.Warning 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Warning
源码 · 目标:net8.0、net9.0、net10.0
public static void Warning<TClass>(string message, EventId eventId, params object[] args)写入 LogLevel.Warning 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Warning
源码 · 目标:net8.0、net9.0、net10.0
public static void Warning<TClass>(string message, Exception exception, params object[] args)写入 LogLevel.Warning 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Warning
源码 · 目标:net8.0、net9.0、net10.0
public static void Warning<TClass>(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Warning 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Error
源码 · 目标:net8.0、net9.0、net10.0
public static void Error(string message, params object[] args)写入 LogLevel.Error 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Error
源码 · 目标:net8.0、net9.0、net10.0
public static void Error(string message, EventId eventId, params object[] args)写入 LogLevel.Error 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Error
源码 · 目标:net8.0、net9.0、net10.0
public static void Error(string message, Exception exception, params object[] args)写入 LogLevel.Error 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Error
源码 · 目标:net8.0、net9.0、net10.0
public static void Error(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Error 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Error
源码 · 目标:net8.0、net9.0、net10.0
public static void Error<TClass>(string message, params object[] args)写入 LogLevel.Error 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Error
源码 · 目标:net8.0、net9.0、net10.0
public static void Error<TClass>(string message, EventId eventId, params object[] args)写入 LogLevel.Error 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Error
源码 · 目标:net8.0、net9.0、net10.0
public static void Error<TClass>(string message, Exception exception, params object[] args)写入 LogLevel.Error 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Error
源码 · 目标:net8.0、net9.0、net10.0
public static void Error<TClass>(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Error 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Debug
源码 · 目标:net8.0、net9.0、net10.0
public static void Debug(string message, params object[] args)写入 LogLevel.Debug 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Debug
源码 · 目标:net8.0、net9.0、net10.0
public static void Debug(string message, EventId eventId, params object[] args)写入 LogLevel.Debug 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Debug
源码 · 目标:net8.0、net9.0、net10.0
public static void Debug(string message, Exception exception, params object[] args)写入 LogLevel.Debug 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Debug
源码 · 目标:net8.0、net9.0、net10.0
public static void Debug(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Debug 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Debug
源码 · 目标:net8.0、net9.0、net10.0
public static void Debug<TClass>(string message, params object[] args)写入 LogLevel.Debug 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Debug
源码 · 目标:net8.0、net9.0、net10.0
public static void Debug<TClass>(string message, EventId eventId, params object[] args)写入 LogLevel.Debug 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Debug
源码 · 目标:net8.0、net9.0、net10.0
public static void Debug<TClass>(string message, Exception exception, params object[] args)写入 LogLevel.Debug 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Debug
源码 · 目标:net8.0、net9.0、net10.0
public static void Debug<TClass>(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Debug 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Trace
源码 · 目标:net8.0、net9.0、net10.0
public static void Trace(string message, params object[] args)写入 LogLevel.Trace 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Trace
源码 · 目标:net8.0、net9.0、net10.0
public static void Trace(string message, EventId eventId, params object[] args)写入 LogLevel.Trace 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Trace
源码 · 目标:net8.0、net9.0、net10.0
public static void Trace(string message, Exception exception, params object[] args)写入 LogLevel.Trace 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Trace
源码 · 目标:net8.0、net9.0、net10.0
public static void Trace(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Trace 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Trace
源码 · 目标:net8.0、net9.0、net10.0
public static void Trace<TClass>(string message, params object[] args)写入 LogLevel.Trace 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Trace
源码 · 目标:net8.0、net9.0、net10.0
public static void Trace<TClass>(string message, EventId eventId, params object[] args)写入 LogLevel.Trace 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Trace
源码 · 目标:net8.0、net9.0、net10.0
public static void Trace<TClass>(string message, Exception exception, params object[] args)写入 LogLevel.Trace 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Trace
源码 · 目标:net8.0、net9.0、net10.0
public static void Trace<TClass>(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Trace 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Critical
源码 · 目标:net8.0、net9.0、net10.0
public static void Critical(string message, params object[] args)写入 LogLevel.Critical 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Critical
源码 · 目标:net8.0、net9.0、net10.0
public static void Critical(string message, EventId eventId, params object[] args)写入 LogLevel.Critical 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Critical
源码 · 目标:net8.0、net9.0、net10.0
public static void Critical(string message, Exception exception, params object[] args)写入 LogLevel.Critical 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Critical
源码 · 目标:net8.0、net9.0、net10.0
public static void Critical(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Critical 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数
Fast.Logging.Log.Critical
源码 · 目标:net8.0、net9.0、net10.0
public static void Critical<TClass>(string message, params object[] args)写入 LogLevel.Critical 级别日志
- 参数
message:要记录或返回的消息 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Critical
源码 · 目标:net8.0、net9.0、net10.0
public static void Critical<TClass>(string message, EventId eventId, params object[] args)写入 LogLevel.Critical 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Critical
源码 · 目标:net8.0、net9.0、net10.0
public static void Critical<TClass>(string message, Exception exception, params object[] args)写入 LogLevel.Critical 级别日志
- 参数
message:要记录或返回的消息 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.Log.Critical
源码 · 目标:net8.0、net9.0、net10.0
public static void Critical<TClass>(string message, EventId eventId, Exception exception, params object[] args)写入 LogLevel.Critical 级别日志
- 参数
message:要记录或返回的消息 - 参数
eventId:日志事件标识 - 参数
exception:要处理的异常 - 参数
args:格式化消息时使用的参数 - 类型参数
TClass:要处理的对象类型
Fast.Logging.LoggerFormatter
源码 · 目标:net8.0、net9.0、net10.0
[SuppressSniffer]
public static class LoggerFormatter日志格式化静态类
`Fast.Logging.LoggerFormatter.Json = logMsg =>
{
return logMsg.Write(writer => WriteJson(logMsg, writer));
}`
源码 · 目标:net8.0、net9.0、net10.0
public static readonly Func<LogMessage, string> Json = logMsg =>
{
return logMsg.Write(writer => WriteJson(logMsg, writer));
};JSON 输出格式化
`Fast.Logging.LoggerFormatter.JsonIndented = logMsg =>
{
return logMsg.Write(writer => WriteJson(logMsg, writer), true);
}`
源码 · 目标:net8.0、net9.0、net10.0
public static readonly Func<LogMessage, string> JsonIndented = logMsg =>
{
return logMsg.Write(writer => WriteJson(logMsg, writer), true);
};JSON 输出格式化
Fast.Logging.StringLoggingPart
源码 · 目标:net8.0、net9.0、net10.0
[SuppressSniffer]
public sealed partial class StringLoggingPart构建字符串日志部分类
Fast.Logging.StringLoggingPart.Default
源码 · 目标:net8.0、net9.0、net10.0
public static StringLoggingPart Default()静态缺省日志部件
- 返回:静态缺省日志部件
Fast.Logging.StringLoggingPart.Message
源码 · 目标:net8.0、net9.0、net10.0
public string Message { get; private set; }日志内容
Fast.Logging.StringLoggingPart.Level
源码 · 目标:net8.0、net9.0、net10.0
public LogLevel Level { get; private set; } = LogLevel.Information;日志级别
Fast.Logging.StringLoggingPart.Args
源码 · 目标:net8.0、net9.0、net10.0
public object[] Args { get; private set; }消息格式化参数
Fast.Logging.StringLoggingPart.EventId
源码 · 目标:net8.0、net9.0、net10.0
public EventId? EventId { get; private set; }事件Id
Fast.Logging.StringLoggingPart.CategoryType
源码 · 目标:net8.0、net9.0、net10.0
public Type CategoryType { get; private set; } = typeof(StringLogging);日志分类类型
Fast.Logging.StringLoggingPart.Exception
源码 · 目标:net8.0、net9.0、net10.0
public Exception Exception { get; private set; }异常对象
Fast.Logging.StringLoggingPart.LoggerScoped
源码 · 目标:net8.0、net9.0、net10.0
public IServiceProvider LoggerScoped { get; private set; }日志对象所在作用域
Fast.Logging.StringLoggingPart.LogContext
源码 · 目标:net8.0、net9.0、net10.0
public LogContext LogContext { get; private set; }日志上下文
Fast.Logging.StringLoggingPart
源码 · 目标:net8.0、net9.0、net10.0
public sealed partial class StringLoggingPart构建字符串日志部分类
Fast.Logging.StringLoggingPart.LogInformation
源码 · 目标:net8.0、net9.0、net10.0
public void LogInformation()Information
Fast.Logging.StringLoggingPart.LogWarning
源码 · 目标:net8.0、net9.0、net10.0
public void LogWarning()Warning
Fast.Logging.StringLoggingPart.LogError
源码 · 目标:net8.0、net9.0、net10.0
public void LogError()Error
Fast.Logging.StringLoggingPart.LogDebug
源码 · 目标:net8.0、net9.0、net10.0
public void LogDebug()Debug
Fast.Logging.StringLoggingPart.LogTrace
源码 · 目标:net8.0、net9.0、net10.0
public void LogTrace()Trace
Fast.Logging.StringLoggingPart.LogCritical
源码 · 目标:net8.0、net9.0、net10.0
public void LogCritical()Critical
Fast.Logging.StringLoggingPart.Log
源码 · 目标:net8.0、net9.0、net10.0
public void Log()按当前日志级别、事件和异常配置写入日志
Fast.Logging.StringLoggingPart
源码 · 目标:net8.0、net9.0、net10.0
public sealed partial class StringLoggingPart构建字符串日志部分类
Fast.Logging.StringLoggingPart.SetMessage
源码 · 目标:net8.0、net9.0、net10.0
public StringLoggingPart SetMessage(string message)设置消息
- 参数
message:要记录或返回的消息 - 返回:设置消息
Fast.Logging.StringLoggingPart.SetLevel
源码 · 目标:net8.0、net9.0、net10.0
public StringLoggingPart SetLevel(LogLevel level)设置日志级别
- 参数
level:日志级别 - 返回:设置日志级别
Fast.Logging.StringLoggingPart.SetArgs
源码 · 目标:net8.0、net9.0、net10.0
public StringLoggingPart SetArgs(params object[] args)设置消息格式化参数
- 参数
args:格式化消息时使用的参数 - 返回:设置消息格式化参数
Fast.Logging.StringLoggingPart.SetEventId
源码 · 目标:net8.0、net9.0、net10.0
public StringLoggingPart SetEventId(EventId eventId)设置事件Id
- 参数
eventId:日志事件标识 - 返回:设置事件Id
Fast.Logging.StringLoggingPart.SetCategory
源码 · 目标:net8.0、net9.0、net10.0
public StringLoggingPart SetCategory<TClass>()设置日志分类
- 类型参数
TClass:要处理的对象类型 - 返回:设置日志分类
Fast.Logging.StringLoggingPart.SetException
源码 · 目标:net8.0、net9.0、net10.0
public StringLoggingPart SetException(Exception exception)设置异常对象
- 参数
exception:要处理的异常 - 返回:设置异常对象
Fast.Logging.StringLoggingPart.SetLoggerScoped
源码 · 目标:net8.0、net9.0、net10.0
public StringLoggingPart SetLoggerScoped(IServiceProvider serviceProvider)设置日志服务作用域
- 参数
serviceProvider:用于解析服务的服务提供器;为null时使用当前请求或根服务提供器 - 返回:设置日志服务作用域
Fast.Logging.StringLoggingPart.ScopeContext
源码 · 目标:net8.0、net9.0、net10.0
public StringLoggingPart ScopeContext(IDictionary<object, object> properties)配置日志上下文
- 参数
properties:要写入上下文的属性集合 - 返回:日志记录器以及用于结束作用域的释放句柄
Fast.Logging.StringLoggingPart.ScopeContext
源码 · 目标:net8.0、net9.0、net10.0
public StringLoggingPart ScopeContext(Action<LogContext> configure)配置日志上下文
- 参数
configure:日志上下文配置操作 - 返回:日志记录器以及用于结束作用域的释放句柄
Fast.Logging.StringLoggingPart.ScopeContext
源码 · 目标:net8.0、net9.0、net10.0
public StringLoggingPart ScopeContext(LogContext context)配置日志上下文
- 参数
context:当前日志上下文 - 返回:日志记录器以及用于结束作用域的释放句柄
Fast.Logging.LoggingSettingsOptions
源码 · 目标:net8.0、net9.0、net10.0
[SuppressSniffer]
public class LoggingSettingsOptions : IPostConfigure日志配置选项
Fast.Logging.LoggingSettingsOptions.FileFormat
源码 · 目标:net8.0、net9.0、net10.0
public string FileFormat { get; set; }文件格式字符串
Fast.Logging.LoggingSettingsOptions.FileSizeLimit
源码 · 目标:net8.0、net9.0、net10.0
public int? FileSizeLimit { get; set; }文件大小限制(字节)
Fast.Logging.LoggingSettingsOptions.MiniLogLevel
源码 · 目标:net8.0、net9.0、net10.0
public LogLevel? MiniLogLevel { get; set; }最小日志级别
Fast.Logging.LoggingSettingsOptions.EnableCritical
源码 · 目标:net8.0、net9.0、net10.0
public bool? EnableCritical { get; set; }启用 LogLevel.Critical 级别日志
Fast.Logging.LoggingSettingsOptions.PostConfigure
源码 · 目标:net8.0、net9.0、net10.0
public void PostConfigure()说明继承自接口或基类,需结合对应声明阅读。
