Class LogEvent.Builder

java.lang.Object
cloud.opencode.base.log.LogEvent.Builder
Enclosing class:
LogEvent

public static final class LogEvent.Builder extends Object
Log Event Builder - Fluent Builder for LogEvent Construction 日志事件构建器 - LogEvent 的流式构建器

Provides a fluent API for building LogEvent instances with sensible defaults for optional fields.

提供流式 API 来构建 LogEvent 实例,可选字段有合理的默认值。

Since:
JDK 25, opencode-base-log V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Details

    • loggerName

      public LogEvent.Builder loggerName(String loggerName)
      Sets the logger name. 设置日志记录器名称。
      Parameters:
      loggerName - the logger name | 日志记录器名称
      Returns:
      this builder | 此构建器
    • throwable

      public LogEvent.Builder throwable(Throwable throwable)
      Sets the throwable. 设置异常。
      Parameters:
      throwable - the throwable | 异常
      Returns:
      this builder | 此构建器
    • marker

      public LogEvent.Builder marker(Marker marker)
      Sets the marker. 设置标记。
      Parameters:
      marker - the marker | 标记
      Returns:
      this builder | 此构建器
    • mdc

      public LogEvent.Builder mdc(Map<String,String> mdc)
      Sets the MDC context map. 设置 MDC 上下文映射。
      Parameters:
      mdc - the MDC map | MDC 映射
      Returns:
      this builder | 此构建器
    • timestamp

      public LogEvent.Builder timestamp(long timestampMillis)
      Sets the timestamp in milliseconds since epoch. 设置自纪元以来的毫秒时间戳。
      Parameters:
      timestampMillis - the timestamp | 时间戳
      Returns:
      this builder | 此构建器
    • threadName

      public LogEvent.Builder threadName(String threadName)
      Sets the thread name. 设置线程名。
      Parameters:
      threadName - the thread name | 线程名
      Returns:
      this builder | 此构建器
    • callerInfo

      public LogEvent.Builder callerInfo(CallerInfo callerInfo)
      Sets the caller info. 设置调用者信息。
      Parameters:
      callerInfo - the caller info | 调用者信息
      Returns:
      this builder | 此构建器
    • build

      public LogEvent build()
      Builds the log event. 构建日志事件。
      Returns:
      the log event | 日志事件