@loglayer/log-level-manager-one-way
v1.0.3
Published
Log level manager for loglayer that keeps log levels synchronized between parent and children (parent changes affect children, but child changes don't affect parents).
Maintainers
Readme
One Way Log Level Manager for LogLayer
A log level manager for LogLayer that keeps log levels synchronized between parent and children. Parent changes affect children, but child changes do not affect parents.
Installation
npm install @loglayer/log-level-manager-one-wayUsage
import { LogLayer, ConsoleTransport, LogLevel } from "loglayer";
import { OneWayLogLevelManager } from '@loglayer/log-level-manager-one-way';
const parentLog = new LogLayer({
transport: new ConsoleTransport({
logger: console
}),
}).withLogLevelManager(new OneWayLogLevelManager());
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 do not affect parent
childLog.setLevel(LogLevel.debug);
parentLog.debug('This will not be logged'); // Not logged (parent still at warn)
childLog.debug('This will be logged'); // Logged (child changed to debug)Documentation
For more details, visit https://loglayer.dev/log-level-managers/one-way
