Logger
Represents a logger utility for logging messages with various log levels.
Constructors
new Logger()
1new Logger(options: LoggerOptions): LoggerConstructs 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
1get active(): booleanGets whether the logger is active or not.
1set active(active: boolean): voidSets whether the logger is active or not.
Parameters
| Parameter | Type |
|---|---|
active | boolean |
Returns
boolean
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:130
level
1get level(): LogLevelsGets the log level of the logger.
1set level(level: LogLevels): voidSets the log level of the logger.
Parameters
| Parameter | Type |
|---|---|
level | LogLevels |
Returns
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:108
name
1get name(): stringGets the name of the logger.
1set name(name: string): voidSets the name of the logger.
Parameters
| Parameter | Type |
|---|---|
name | string |
Returns
string
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:144
saveOnFile
1get saveOnFile(): boolean1set saveOnFile(saveOnFile: boolean): voidParameters
| Parameter | Type |
|---|---|
saveOnFile | boolean |
Returns
boolean
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:116
Methods
debug()
1debug(...args: any[]): voidLogs 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()
1error(...args: any[]): voidLogs 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()
1fatal(...args: any[]): voidLogs 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()
1info(...args: any[]): voidLogs 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()
1rawLog(level: LogLevels, ...args: unknown[]): voidLogs 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()
1warn(...args: any[]): voidLogs 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()
1static clearLogs(): Promise<void>Returns
Promise<void>
Source
twitchfy/packages/eventsub/src/logger/Logger.ts:82
customize()
1static customize(cb: CustomCallback): voidAllows 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
1Logger.customize((logger, level, args) => {2 // Custom logging implementation3});Source
twitchfy/packages/eventsub/src/logger/Logger.ts:78
noColor()
1static noColor(msg: string): stringA 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.