Skip to content

struct LogEntry

cangjie
public struct LogEntry<TState>

功能:封装单条日志记录的上下文信息。

成员概览

成员功能
init(LogLevel, String, EventId, TState, ?Exception, (TState, ?Exception) -> String)创建一条日志记录上下文。
prop logLevel获取日志级别。
prop category获取日志分类名称。
prop eventId获取事件标识。
prop state获取日志状态对象。
prop exception获取关联的异常对象。
prop formatter获取日志格式化函数。

init(LogLevel, String, EventId, TState, ?Exception, (TState, ?Exception) -> String)

cangjie
public init(logLevel: LogLevel, category: String, eventId: EventId, state: TState, exception: ?Exception,
formatter: (TState, ?Exception) -> String)

功能:创建一条日志记录上下文。

参数:

  • logLevel: LogLevel - 日志级别。
  • category: String - 日志分类名称。
  • eventId: EventId - 事件标识。
  • state: TState - 日志状态对象。
  • exception: ?Exception - 关联的异常对象。
  • formatter: (TState, ?Exception) -> String - 将状态格式化为字符串的函数。

prop logLevel

cangjie
public prop logLevel: LogLevel

功能:获取日志级别。

类型:LogLevel

prop category

cangjie
public prop category: String

功能:获取日志分类名称。

类型:String

prop eventId

cangjie
public prop eventId: EventId

功能:获取事件标识。

类型:EventId

prop state

cangjie
public prop state: TState

功能:获取日志状态对象。

类型:TState

prop exception

cangjie
public prop exception: ?Exception

功能:获取关联的异常对象。

类型:?Exception

prop formatter

cangjie
public prop formatter: (TState, ?Exception) -> String

功能:获取日志格式化函数。

类型:(TState, ?Exception) -> String