interface ILogger
public interface ILogger功能:定义日志记录器的公共接口。
成员概览
func log(LogLevel, EventId, TState, ?Exception, (TState, ?Exception) -> String)
func log<TState>(logLevel: LogLevel, eventId: EventId, state: TState, exception: ?Exception,
formatter: (TState, ?Exception) -> String): Unit where TState <: ToString功能:按指定级别记录日志。
参数:
- logLevel: LogLevel - 日志级别。
- eventId: EventId - 事件标识。
- state:
TState- 日志状态对象。 - exception:
?Exception- 关联的异常对象。 - formatter:
(TState, ?Exception) -> String- 将状态格式化为字符串的函数。
返回值:
Unit
func log(LogEntry<TState>)
func log<TState>(entry: LogEntry<TState>): Unit where TState <: ToString功能:按日志条目记录日志。
参数:
- entry: LogEntry<TState> - 单条日志记录的完整上下文。
返回值:
Unit
func log(LogLevel, ?String)
func log(logLevel: LogLevel, message: ?String): Unit功能:按消息记录日志。
参数:
- logLevel: LogLevel - 日志级别。
- message:
?String- 日志消息。
返回值:
Unit
func log(LogLevel, EventId, ?String)
func log(logLevel: LogLevel, eventId: EventId, message: ?String): Unit功能:按事件标识和消息记录日志。
参数:
返回值:
Unit
func log(LogLevel, ?Exception, ?String)
func log(logLevel: LogLevel, exception: ?Exception, message: ?String): Unit功能:按异常和消息记录日志。
参数:
- logLevel: LogLevel - 日志级别。
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func log(LogLevel, EventId, ?Exception, ?String)
func log(logLevel: LogLevel, eventId: EventId, exception: ?Exception, message: ?String): Unit功能:按事件标识、异常和消息记录日志。
参数:
- logLevel: LogLevel - 日志级别。
- eventId: EventId - 事件标识。
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func isEnabled(LogLevel)
func isEnabled(logLevel: LogLevel): Bool功能:检查指定日志级别是否启用。
参数:
- logLevel: LogLevel - 要检查的日志级别。
返回值:
Bool- 如果该级别已启用则返回true,否则返回false。
func trace(?String)
func trace(message: ?String): Unit功能:记录一条跟踪级别日志。
参数:
- message:
?String- 日志消息。
返回值:
Unit
func trace(EventId, ?String)
func trace(eventId: EventId, message: ?String): Unit功能:记录一条带事件标识的跟踪级别日志。
参数:
- eventId: EventId - 事件标识。
- message:
?String- 日志消息。
返回值:
Unit
func trace(?Exception, ?String)
func trace(exception: ?Exception, message: ?String): Unit功能:记录一条带异常的跟踪级别日志。
参数:
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func trace(EventId, ?Exception, ?String)
func trace(eventId: EventId, exception: ?Exception, message: ?String): Unit功能:记录一条带事件标识和异常的跟踪级别日志。
参数:
- eventId: EventId - 事件标识。
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func debug(?String)
func debug(message: ?String): Unit功能:记录一条调试级别日志。
参数:
- message:
?String- 日志消息。
返回值:
Unit
func debug(EventId, ?String)
func debug(eventId: EventId, message: ?String): Unit功能:记录一条带事件标识的调试级别日志。
参数:
- eventId: EventId - 事件标识。
- message:
?String- 日志消息。
返回值:
Unit
func debug(?Exception, ?String)
func debug(exception: ?Exception, message: ?String): Unit功能:记录一条带异常的调试级别日志。
参数:
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func debug(EventId, ?Exception, ?String)
func debug(eventId: EventId, exception: ?Exception, message: ?String): Unit功能:记录一条带事件标识和异常的调试级别日志。
参数:
- eventId: EventId - 事件标识。
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func info(?String)
func info(message: ?String): Unit功能:记录一条信息级别日志。
参数:
- message:
?String- 日志消息。
返回值:
Unit
func info(EventId, ?String)
func info(eventId: EventId, message: ?String): Unit功能:记录一条带事件标识的信息级别日志。
参数:
- eventId: EventId - 事件标识。
- message:
?String- 日志消息。
返回值:
Unit
func info(?Exception, ?String)
func info(exception: ?Exception, message: ?String): Unit功能:记录一条带异常的信息级别日志。
参数:
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func info(EventId, ?Exception, ?String)
func info(eventId: EventId, exception: ?Exception, message: ?String): Unit功能:记录一条带事件标识和异常的信息级别日志。
参数:
- eventId: EventId - 事件标识。
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func warn(?String)
func warn(message: ?String): Unit功能:记录一条警告级别日志。
参数:
- message:
?String- 日志消息。
返回值:
Unit
func warn(EventId, ?String)
func warn(eventId: EventId, message: ?String): Unit功能:记录一条带事件标识的警告级别日志。
参数:
- eventId: EventId - 事件标识。
- message:
?String- 日志消息。
返回值:
Unit
func warn(?Exception, ?String)
func warn(exception: ?Exception, message: ?String): Unit功能:记录一条带异常的警告级别日志。
参数:
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func warn(EventId, ?Exception, ?String)
func warn(eventId: EventId, exception: ?Exception, message: ?String): Unit功能:记录一条带事件标识和异常的警告级别日志。
参数:
- eventId: EventId - 事件标识。
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func error(?String)
func error(message: ?String): Unit功能:记录一条错误级别日志。
参数:
- message:
?String- 日志消息。
返回值:
Unit
func error(EventId, ?String)
func error(eventId: EventId, message: ?String): Unit功能:记录一条带事件标识的错误级别日志。
参数:
- eventId: EventId - 事件标识。
- message:
?String- 日志消息。
返回值:
Unit
func error(?Exception, ?String)
func error(exception: ?Exception, message: ?String): Unit功能:记录一条带异常的错误级别日志。
参数:
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func error(EventId, ?Exception, ?String)
func error(eventId: EventId, exception: ?Exception, message: ?String): Unit功能:记录一条带事件标识和异常的错误级别日志。
参数:
- eventId: EventId - 事件标识。
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func fatal(?String)
func fatal(message: ?String): Unit功能:记录一条致命级别日志。
参数:
- message:
?String- 日志消息。
返回值:
Unit
func fatal(EventId, ?String)
func fatal(eventId: EventId, message: ?String): Unit功能:记录一条带事件标识的致命级别日志。
参数:
- eventId: EventId - 事件标识。
- message:
?String- 日志消息。
返回值:
Unit
func fatal(?Exception, ?String)
func fatal(exception: ?Exception, message: ?String): Unit功能:记录一条带异常的致命级别日志。
参数:
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit
func fatal(EventId, ?Exception, ?String)
func fatal(eventId: EventId, exception: ?Exception, message: ?String): Unit功能:记录一条带事件标识和异常的致命级别日志。
参数:
- eventId: EventId - 事件标识。
- exception:
?Exception- 关联的异常对象。 - message:
?String- 日志消息。
返回值:
Unit