@enreachde/swyx-web-extension-sdk - v1.0.1 / Exports / ConsoleLogger
Class: ConsoleLogger
ConsoleLogger is a simple implementation of ILogger that logs messages to the console. It supports different log levels and formats the log messages with timestamps, log level, module name, method name, and an optional message.
Implements
Table of contents
Constructors
Methods
Constructors
constructor
• new ConsoleLogger(logLevel?): ConsoleLogger
Creates an instance of ConsoleLogger.
Parameters
| Name | Type | Default value | Description |
|---|---|---|---|
logLevel | LogLevel | LogLevel.Information | The initial log level for the logger. Optional. Defaults to LogLevel.Information. |
Returns
Methods
debug
▸ debug(module, method, message?): void
Writes a debug log message.
Parameters
| Name | Type | Description |
|---|---|---|
module | string | The name of the module that is writing the log message. |
method | string | The name of the method that is writing the log message. |
message? | string | The log message to write. Optional. If not provided, the logger implementation may choose to log the module and method information only. |
Returns
void
Implementation of
error
▸ error(module, method, message?): void
Writes an error log message.
Parameters
| Name | Type | Description |
|---|---|---|
module | string | The name of the module that is writing the log message. |
method | string | The name of the method that is writing the log message. |
message? | string | The log message to write. Optional. If not provided, the logger implementation may choose to log the module and method information only. |
Returns
void
Implementation of
getLogLevel
▸ getLogLevel(): LogLevel
Returns the currently active log level.
Returns
Implementation of
info
▸ info(module, method, message?): void
Writes an informational log message.
Parameters
| Name | Type | Description |
|---|---|---|
module | string | The name of the module that is writing the log message. |
method | string | The name of the method that is writing the log message. |
message? | string | The log message to write. Optional. If not provided, the logger implementation may choose to log the module and method information only. |
Returns
void
Implementation of
log
▸ log(logLevel, module, method, message?): void
Writes a log message at the provided level.
Parameters
| Name | Type | Description |
|---|---|---|
logLevel | LogLevel | The log level to write the message at. |
module | string | The name of the module that is writing the log message. |
method | string | The name of the method that is writing the log message. |
message? | string | The log message to write. Optional. If not provided, the logger implementation may choose to log the module and method information only. |
Returns
void
Implementation of
notice
▸ notice(module, method, message?): void
Writes a notice log message.
Parameters
| Name | Type | Description |
|---|---|---|
module | string | The name of the module that is writing the log message. |
method | string | The name of the method that is writing the log message. |
message? | string | The log message to write. Optional. If not provided, the logger implementation may choose to log the module and method information only. |
Returns
void
Implementation of
setLogLevel
▸ setLogLevel(logLevel): void
Updates the currently active log level.
Parameters
| Name | Type |
|---|---|
logLevel | LogLevel |
Returns
void
Implementation of
verbose
▸ verbose(module, method, message?): void
Writes a verbose log message.
Parameters
| Name | Type | Description |
|---|---|---|
module | string | The name of the module that is writing the log message. |
method | string | The name of the method that is writing the log message. |
message? | string | The log message to write. Optional. If not provided, the logger implementation may choose to log the module and method information only. |
Returns
void
Implementation of
warn
▸ warn(module, method, message?): void
Writes a warning log message.
Parameters
| Name | Type | Description |
|---|---|---|
module | string | The name of the module that is writing the log message. |
method | string | The name of the method that is writing the log message. |
message? | string | The log message to write. Optional. If not provided, the logger implementation may choose to log the module and method information only. |
Returns
void