logger top-level property
A flexible and centralized logger that supports multiple logging strategies.
StrategicLogger
is designed to handle logging across various levels and strategies,
allowing for detailed logging control throughout an application. It ensures that only a single
instance of the logger is initialized and used throughout the application lifecycle.
The logger must be initialized before use, with the desired log level and strategies provided. After initialization, the logger can be reconfigured, but this should be used with caution to avoid unintended side effects during the application lifecycle.
Example:
await logger.initialize(strategies: [ConsoleLogStrategy()], level: LogLevel.info);
logger.log("Application started.");
Implementation
StrategicLogger logger = StrategicLogger();