Skip to main content

@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​

NameTypeDefault valueDescription
logLevelLogLevelLogLevel.InformationThe initial log level for the logger. Optional. Defaults to LogLevel.Information.

Returns​

ConsoleLogger

Methods​

debug​

▸ debug(module, method, message?): void

Writes a debug log message.

Parameters​

NameTypeDescription
modulestringThe name of the module that is writing the log message.
methodstringThe name of the method that is writing the log message.
message?stringThe 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​

ILogger.debug


error​

▸ error(module, method, message?): void

Writes an error log message.

Parameters​

NameTypeDescription
modulestringThe name of the module that is writing the log message.
methodstringThe name of the method that is writing the log message.
message?stringThe 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​

ILogger.error


getLogLevel​

▸ getLogLevel(): LogLevel

Returns the currently active log level.

Returns​

LogLevel

Implementation of​

ILogger.getLogLevel


info​

▸ info(module, method, message?): void

Writes an informational log message.

Parameters​

NameTypeDescription
modulestringThe name of the module that is writing the log message.
methodstringThe name of the method that is writing the log message.
message?stringThe 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​

ILogger.info


log​

▸ log(logLevel, module, method, message?): void

Writes a log message at the provided level.

Parameters​

NameTypeDescription
logLevelLogLevelThe log level to write the message at.
modulestringThe name of the module that is writing the log message.
methodstringThe name of the method that is writing the log message.
message?stringThe 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​

ILogger.log


notice​

▸ notice(module, method, message?): void

Writes a notice log message.

Parameters​

NameTypeDescription
modulestringThe name of the module that is writing the log message.
methodstringThe name of the method that is writing the log message.
message?stringThe 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​

ILogger.notice


setLogLevel​

▸ setLogLevel(logLevel): void

Updates the currently active log level.

Parameters​

NameType
logLevelLogLevel

Returns​

void

Implementation of​

ILogger.setLogLevel


verbose​

▸ verbose(module, method, message?): void

Writes a verbose log message.

Parameters​

NameTypeDescription
modulestringThe name of the module that is writing the log message.
methodstringThe name of the method that is writing the log message.
message?stringThe 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​

ILogger.verbose


warn​

▸ warn(module, method, message?): void

Writes a warning log message.

Parameters​

NameTypeDescription
modulestringThe name of the module that is writing the log message.
methodstringThe name of the method that is writing the log message.
message?stringThe 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​

ILogger.warn