Loading LLD design...
Design an object-oriented logging framework that supports multiple log levels (DEBUG, INFO, WARNING, ERROR, FATAL), writes to pluggable sinks (console, file, database), and exposes a singleton API for application-wide access.
The framework should filter messages by a configurable minimum level, format output with timestamps and source info, and be extensible for new sinks without modifying existing code.
Log messages at different levels
Support DEBUG, INFO, WARNING, ERROR, and FATAL log levels
Filter by log level
Only process messages at or above the configured minimum level
Write to multiple sinks
Fan-out each log message to console, file, database, or custom sinks simultaneously
Format log output
Produce structured log strings with timestamp, level, source, and message
Global logger access
Provide a single shared logger instance across the application via Singleton
Configure at runtime
Add/remove sinks and change log level without restarting the application
Before diving into code, clarify the use cases and edge cases. Understanding the problem deeply leads to better class design.
Identify the primary actions users will perform. For a parking lot: park vehicle, exit vehicle, check availability. Each becomes a method.
Who interacts with the system? Customers, admins, automated systems? Each actor type may need different interfaces.
What are the limits? Max vehicles, supported vehicle types, payment methods. Constraints drive your data structures.
What happens on overflow? Concurrent access? Payment failures? Thinking about edge cases reveals hidden complexity.