Well defined logging library API
Difficulty: EASYCategory: LLDFrequency: 1Asked On 2024-08-18
Problem Statement
Design and implement a logging library similar to those used in production systems (like log4j, slf4j, or LoggerFactory). The system should provide a simple and fluent API for logging messages at different levels and allow future extensibility such as concurrent writes, appenders (e.g., file, console), and log filtering.
🎯 Functional Requirements
Core APIs:
1.Logger.getInstance()
•Returns a singleton instance of the logger.
2.logger.info(String message)
•Logs an INFO level message.
3.logger.debug(String message)
•Logs a DEBUG level message.
4.logger.error(String message)
•Logs an ERROR level message.
5.Support for a fluent interface:
1java
2CopyEdit
3logger.level(LogLevel.INFO).message("Application started").log();