logger library
Classes
- Level
- Levels to control logging output. Logging can be enabled to include all levels above certain Level. Levels are ordered using an integer value Level.value. The predefined Level constants below are sorted as follows (in descending order): Level.SHOUT, Level.SEVERE, Level.WARNING, Level.INFO, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, and Level.ALL.
- Logger
- Use a Logger to log debug messages.
- LogRecord
- A log entry representation used to propagate information from Logger to individual handlers.
Extensions
Constants
- defaultLevel → const Level
- The default Level.
Properties
- hierarchicalLoggingEnabled ↔ bool
-
Whether to allow fine-grain logging and configuration of loggers in a
hierarchy.
getter/setter pair
- recordStackTraceAtLevel ↔ Level
-
Automatically record stack traces for any message of this level or above.
getter/setter pair
Functions
-
attachStderrLogSink(
{Level? level}) → StreamSubscription< LogRecord> - Route all log records to stderr so a stdio-based MCP host cannot have its stdout — which carries the protocol JSON-RPC stream — corrupted by log output. Opt-in and idempotent: call it once during startup on the stdio transport. 2025-11-25 clarifies servers may emit logs at any level to stderr on the stdio transport.
-
detachStderrLogSink(
) → Future< void> - Remove the stderr log sink installed by attachStderrLogSink. Safe to call when no sink is attached.