@loglayer/log-level-manager-linked
v1.0.3
Published
Log level manager for loglayer that keeps log levels synchronized between parent and children (parent and child changes affect each other bidirectionally).
Maintainers
Readme
Linked Log Level Manager for LogLayer
A log level manager for LogLayer that keeps log levels synchronized between parent and children. Parent and child changes affect each other bidirectionally.
Installation
npm install @loglayer/log-level-manager-linkedUsage
import { LogLayer, ConsoleTransport, LogLevel } from "loglayer";
import { LinkedLogLevelManager } from '@loglayer/log-level-manager-linked';
const parentLog = new LogLayer({
transport: new ConsoleTransport({
logger: console
}),
}).withLogLevelManager(new LinkedLogLevelManager());
const childLog = parentLog.child();
// Parent changes affect children
parentLog.setLevel(LogLevel.warn);
childLog.info('This will not be logged'); // Not logged (affected by parent)
// Child changes also affect parent
childLog.setLevel(LogLevel.debug);
parentLog.debug('This will be logged'); // Logged (affected by child)
childLog.debug('This will be logged'); // Logged (child changed to debug)Documentation
For more details, visit https://loglayer.dev/log-level-managers/linked
