Interface Marker
public interface Marker
Marker Interface - Log Event Marker
标记接口 - 日志事件标记
Markers are named objects used to enrich log statements. A marker can reference other markers, creating a hierarchy of markers.
标记是用于丰富日志语句的命名对象。标记可以引用其他标记,创建标记层次结构。
Example | 示例:
// Create and use a marker
Marker security = Markers.getMarker("SECURITY");
OpenLog.info(security, "User {} authenticated", userId);
// Create a marker with references
Marker audit = Markers.getMarker("AUDIT", security);
Features | 主要功能:
- Named marker for log event categorization - 用于日志事件分类的命名标记
- Hierarchical marker references - 分层标记引用
- Contains check by marker or name - 按标记或名称检查包含关系
Security | 安全性:
- Thread-safe: Implementation-dependent - 线程安全: 取决于实现
- Null-safe: No (throws on null reference) - 空值安全: 否(null 引用抛异常)
- Since:
- JDK 25, opencode-base-log V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a reference to another marker.booleanChecks if this marker contains the specified marker.booleanChecks if this marker contains a marker with the specified name.booleanChecks if this marker is equal to the specified marker.getName()Returns the name of this marker.inthashCode()Returns the hash code of this marker.booleanChecks if this marker has any references.iterator()Returns an iterator over the referenced markers.booleanRemoves a reference to another marker.
-
Method Details
-
getName
-
add
Adds a reference to another marker. 添加对另一个标记的引用。- Parameters:
reference- the marker to reference - 要引用的标记
-
remove
Removes a reference to another marker. 移除对另一个标记的引用。- Parameters:
reference- the marker reference to remove - 要移除的标记引用- Returns:
- true if the reference was removed - 如果移除成功返回 true
-
hasReferences
boolean hasReferences()Checks if this marker has any references. 检查此标记是否有任何引用。- Returns:
- true if this marker has references - 如果有引用返回 true
-
iterator
-
contains
Checks if this marker contains the specified marker. 检查此标记是否包含指定的标记。- Parameters:
other- the marker to check - 要检查的标记- Returns:
- true if this marker contains the other marker - 如果包含返回 true
-
contains
Checks if this marker contains a marker with the specified name. 检查此标记是否包含具有指定名称的标记。- Parameters:
name- the marker name to check - 要检查的标记名称- Returns:
- true if this marker contains a marker with the name - 如果包含返回 true
-
equals
-
hashCode
-