-
Notifications
You must be signed in to change notification settings - Fork 2
Subsystems
Subsystems provide a logical grouping mechanism for log messages, independent of channels and backends.
They allow fine-grained control over which messages are included in logs without restructuring channel topology.
A subsystem is a logical tag associated with a log message.
It represents a functional area or feature of the application, such as:
- networking
- storage
- defragmentation
- cache
- database
Subsystems are orthogonal to channels.
Channels are well suited for:
- routing messages
- selecting backends
- splitting output into different files
Subsystems solve a different problem:
- selective inclusion or exclusion of message groups
- early filtering within a single log stream
This is especially useful when:
- a single large log file is used
- some functional areas are only occasionally relevant
Subsystem identifiers are specified as part of logging macros.
Subsystems are checked early in the routing pipeline. If a message specifies a subsystem that is currently disabled, the message is dropped immediately and does not reach any channel or backend.
Subsystem identifiers may be included in the output as the
#subsystem field when OutputFlags.Subsystem is enabled.
Subsystems can be enabled or disabled dynamically, allowing runtime control over log verbosity.
| Aspect | Channels | Subsystems |
|---|---|---|
| Purpose | Routing and output | Logical grouping and filtering |
| Controls routing | Yes | No |
| Controls file selection | Yes | No |
| Filters messages | Yes (level / enabled state) | Yes (by subsystem state) |
| Typical use | Separate logs | Filter within one log |
While subsystems do not control routing or backend selection, disabling a subsystem prevents messages from reaching any backend, including file backends.
An application writes all logs to a single file, but uses a separate subsystem for storage defragmentation.
When defragmentation details are not needed, the subsystem can be disabled, preventing those messages from being written to the log file without affecting other output.
logme — flexible runtime logging system
Home · Getting Started · Architecture · Output · Backends · Configuration
GitHub: https://github.com/efmsoft/logme