Outputs messages to the console based on the specified log level.
Supports placeholder substitution in messages (e.g., {key}) using values from the optional
context object. Context keys not used in substitution are appended to the output as additional
data. Each log message is prefixed with the log level in square brackets (e.g., [INFO]).
Example
Constlogger = newConsoleLogger(LogLevel.DEBUG); logger.info('User {username} logged in', { username: 'alice', ip: '127.0.0.1' }); // Output: [INFO] User alice logged in { ip: "127.0.0.1" }
Outputs messages to the console based on the specified log level.
Supports placeholder substitution in messages (e.g.,
{key}) using values from the optionalcontextobject. Context keys not used in substitution are appended to the output as additional data. Each log message is prefixed with the log level in square brackets (e.g.,[INFO]).Example