Logging
Clover provides a flexible logging system that can be integrated with any logging library. By default, Clover uses a no-op logger that does nothing.
Logging
Clover provides a flexible logging system that can be integrated with any logging library. By default, Clover uses a no-op logger that does nothing.
Setup
To configure logging, use the setLogger
function to provide a logger implementation that matches the ILogger
interface:
Log Levels
Clover supports these standard log levels:
debug
: Detailed debugging informationinfo
: General system operationwarn
: Warning messages for potential issueserror
: Error messages for serious problems
Logger Interface
The logger interface is simple and flexible:
Helper Functions
Clover provides several helper functions for logging:
Default Logger
If no logger is set, Clover uses a no-op logger that silently discards all log messages. This ensures your application works even without logging configured, but you should set up proper logging for production use.
Automatic Logging
Clover automatically logs important events during request processing. Here are the key logging points:
Each log entry includes contextual information to help with debugging and monitoring. The log levels are chosen to appropriately reflect the severity of each event:
debug
: Used for routine operations like request start/completion and successful responseswarn
: Used for expected errors like validation failures or incorrect HTTP methodserror
: Used for unexpected errors like unhandled exceptions or authentication failures
All log messages are prefixed with "Handler ${method} ${path}"
for consistent log filtering and searching.