Class MarkerFilter
java.lang.Object
cloud.opencode.base.log.filter.MarkerFilter
- All Implemented Interfaces:
LogFilter
Marker Filter - Filters Log Events by Marker Name
标记过滤器 - 按标记名称过滤日志事件
Evaluates whether a log event has a marker matching the configured name, returning the configured action for match and mismatch cases.
评估日志事件是否具有与配置名称匹配的标记, 为匹配和不匹配情况返回配置的动作。
Features | 主要功能:
- Marker name matching - 标记名称匹配
- Configurable match and mismatch actions - 可配置的匹配和不匹配动作
- Supports marker hierarchy via contains() - 通过 contains() 支持标记层次结构
Usage Examples | 使用示例:
// Accept SECURITY markers, neutral otherwise
MarkerFilter filter = new MarkerFilter("SECURITY", FilterAction.ACCEPT, FilterAction.NEUTRAL);
// Deny non-AUDIT events
MarkerFilter auditOnly = new MarkerFilter("AUDIT", FilterAction.NEUTRAL, FilterAction.DENY);
Security | 安全性:
- Thread-safe: Yes (immutable) - 线程安全: 是(不可变)
- Since:
- JDK 25, opencode-base-log V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMarkerFilter(String markerName, FilterAction onMatch, FilterAction onMismatch) Creates a marker filter with the specified name and actions. -
Method Summary
Modifier and TypeMethodDescriptionFilters the event based on its marker.
-
Constructor Details
-
MarkerFilter
Creates a marker filter with the specified name and actions. 使用指定的名称和动作创建标记过滤器。- Parameters:
markerName- the marker name to match | 要匹配的标记名称onMatch- the action when marker matches | 标记匹配时的动作onMismatch- the action when marker does not match | 标记不匹配时的动作- Throws:
NullPointerException- if any argument is null | 如果任何参数为 null
-
-
Method Details