Logger
Represents a logger utility for logging messages with various log levels.
Constructors
new Logger()
Constructs a new Logger instance with the provided options.
Parameters
Parameter | Type | Description |
---|---|---|
options | LoggerOptions | The options for configuring the logger. |
Returns
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:94
Properties
Property | Modifier | Type | Default value | Description |
---|---|---|---|---|
options | readonly | Required <LoggerOptions > | undefined | The options for configuring the logger. |
DEFAULT_OPTIONS | static | Required <LoggerOptions > | ... | The default options for the logger. |
colorFunctions | static | Map <LogLevels , (str : string ) => string > | ... | A map containing color functions for different log levels. |
dirname | static | string | 'eventsub-logs' | - |
prefixes | static | Map <LogLevels , string > | ... | A map containing prefixes for different log levels. |
saveOnFile? | static | string [] | "all" | undefined | - |
streams | static | Partial <Record <string , WriteStream >> | {} | - |
Accessors
active
Gets whether the logger is active or not.
Sets whether the logger is active or not.
Parameters
Parameter | Type |
---|---|
active | boolean |
Returns
boolean
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:130
level
Gets the log level of the logger.
Sets the log level of the logger.
Parameters
Parameter | Type |
---|---|
level | LogLevels |
Returns
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:108
name
Gets the name of the logger.
Sets the name of the logger.
Parameters
Parameter | Type |
---|---|
name | string |
Returns
string
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:144
saveOnFile
Parameters
Parameter | Type |
---|---|
saveOnFile | boolean |
Returns
boolean
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:116
Methods
debug()
Logs a debug message.
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:182
error()
Logs an error message.
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:206
fatal()
Logs a fatal error message.
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:214
info()
Logs an info message.
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:190
rawLog()
Logs a message with the specified log level.
Parameters
Parameter | Type | Description |
---|---|---|
level | LogLevels | The log level. |
…args | unknown [] | The arguments to log. |
Returns
void
The logged message.
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:154
warn()
Logs a warning message.
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:198
clearLogs()
Returns
Promise
<void
>
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:82
customize()
Allows customization of the logging behavior by providing a custom callback function.
Parameters
Parameter | Type | Description |
---|---|---|
cb | CustomCallback | The custom callback function for logging. |
Returns
void
Example
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:78
noColor()
A function that returns the input string as is, without any color modification.
Parameters
Parameter | Type | Description |
---|---|---|
msg | string | The message to log. |
Returns
string
The input message as is.