Class Markers

java.lang.Object
cloud.opencode.base.log.marker.Markers

public final class Markers extends Object
Markers - Marker Factory and Predefined Markers 标记工厂和预定义标记

This class provides factory methods for creating markers and defines commonly used predefined markers for categorizing log events.

此类提供创建标记的工厂方法,并定义用于分类日志事件的常用预定义标记。

Predefined Markers | 预定义标记:

  • SECURITY - Security-related events - 安全相关事件
  • PERFORMANCE - Performance metrics - 性能指标
  • AUDIT - Audit trail events - 审计跟踪事件
  • BUSINESS - Business logic events - 业务逻辑事件
  • SYSTEM - System-level events - 系统级事件
  • DATABASE - Database operations - 数据库操作
  • NETWORK - Network operations - 网络操作

Features | 主要功能:

  • Factory methods for creating markers - 创建标记的工厂方法
  • 10 predefined markers (SECURITY, AUDIT, PERFORMANCE, etc.) - 10 个预定义标记(SECURITY、AUDIT、PERFORMANCE 等)
  • Thread-safe marker registry - 线程安全的标记注册表

Usage Examples | 使用示例:

// Get predefined marker
Marker audit = Markers.AUDIT;
OpenLog.info(audit, "User action logged");

// Create custom marker
Marker custom = Markers.getMarker("MY_MARKER");

// Create marker with references
Marker child = Markers.getMarker("CHILD", Markers.SECURITY);
Since:
JDK 25, opencode-base-log V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Field Details

    • SECURITY

      public static final Marker SECURITY
      Security-related events - 安全相关事件
    • PERFORMANCE

      public static final Marker PERFORMANCE
      Performance metrics - 性能指标
    • AUDIT

      public static final Marker AUDIT
      Audit trail events - 审计跟踪事件
    • BUSINESS

      public static final Marker BUSINESS
      Business logic events - 业务逻辑事件
    • SYSTEM

      public static final Marker SYSTEM
      System-level events - 系统级事件
    • DATABASE

      public static final Marker DATABASE
      Database operations - 数据库操作
    • NETWORK

      public static final Marker NETWORK
      Network operations - 网络操作
    • SENSITIVE

      public static final Marker SENSITIVE
      Sensitive data marker - 敏感数据标记
    • CONFIDENTIAL

      public static final Marker CONFIDENTIAL
      Confidential marker - 机密标记
    • ENTRY_EXIT

      public static final Marker ENTRY_EXIT
      Entry/Exit marker - 入口/出口标记
  • Method Details

    • getMarker

      public static Marker getMarker(String name)
      Gets or creates a marker with the specified name. 获取或创建具有指定名称的标记。
      Parameters:
      name - the marker name - 标记名称
      Returns:
      the marker - 标记
    • getMarker

      public static Marker getMarker(String name, Marker... references)
      Gets or creates a marker with references. 获取或创建带引用的标记。
      Parameters:
      name - the marker name - 标记名称
      references - the reference markers - 引用标记
      Returns:
      the marker - 标记
    • exists

      public static boolean exists(String name)
      Checks if a marker with the specified name exists. 检查具有指定名称的标记是否存在。
      Parameters:
      name - the marker name - 标记名称
      Returns:
      true if exists - 如果存在返回 true
    • detachMarker

      public static boolean detachMarker(String name)
      Removes a marker from the registry. 从注册表中移除标记。
      Parameters:
      name - the marker name - 标记名称
      Returns:
      true if removed - 如果移除成功返回 true
    • getMarkerNames

      public static Set<String> getMarkerNames()
      Returns all registered marker names. 返回所有注册的标记名称。
      Returns:
      the marker names - 标记名称