Logger
Represents a logger utility for logging messages with various log levels.
Constructors
new Logger(options)
1new Logger(options: LoggerOptions): Logger
Constructs a new Logger instance with the provided options.
Parameters
Parameter | Type | Description |
---|---|---|
options | LoggerOptions | The options for configuring the logger. |
Returns
Source
seyfert/src/common/it/logger.ts:66
Properties
Property | Modifier | Type | Description |
---|---|---|---|
options | readonly | Required <LoggerOptions > | 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 | - |
prefixes | static | Map <LogLevels , string > | A map containing prefixes for different log levels. |
saveOnFile? | static | string [] | "all" | - |
streams | static | Partial <Record <string , WriteStream >> | - |
Accessors
active
1get active(): boolean
Gets whether the logger is active or not.
1set active(active: boolean): void
Sets whether the logger is active or not.
Parameters
Parameter | Type |
---|---|
active | boolean |
Returns
boolean
Source
seyfert/src/common/it/logger.ts:102
level
1get level(): LogLevels
Gets the log level of the logger.
1set level(level: LogLevels): void
Sets the log level of the logger.
Parameters
Parameter | Type |
---|---|
level | LogLevels |
Returns
LogLevels
Source
seyfert/src/common/it/logger.ts:80
name
1get name(): string
Gets the name of the logger.
1set name(name: string): void
Sets the name of the logger.
Parameters
Parameter | Type |
---|---|
name | string |
Returns
string
Source
seyfert/src/common/it/logger.ts:116
saveOnFile
1get saveOnFile(): boolean
1set saveOnFile(saveOnFile: boolean): void
Parameters
Parameter | Type |
---|---|
saveOnFile | boolean |
Returns
boolean
Source
seyfert/src/common/it/logger.ts:88
Methods
debug()
1debug(...args: any[]): void
Logs a debug message.
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Source
seyfert/src/common/it/logger.ts:154
error()
1error(...args: any[]): void
Logs an error message.
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Source
seyfert/src/common/it/logger.ts:178
fatal()
1fatal(...args: any[]): void
Logs a fatal error message.
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Source
seyfert/src/common/it/logger.ts:186
info()
1info(...args: any[]): void
Logs an info message.
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Source
seyfert/src/common/it/logger.ts:162
rawLog()
1rawLog(level: LogLevels, ...args: unknown[]): void
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
seyfert/src/common/it/logger.ts:126
warn()
1warn(...args: any[]): void
Logs a warning message.
Parameters
Parameter | Type | Description |
---|---|---|
…args | any [] | The arguments to log. |
Returns
void
Source
seyfert/src/common/it/logger.ts:170
clearLogs()
1static clearLogs(): Promise<void>
Returns
Promise
<void
>
Source
seyfert/src/common/it/logger.ts:54
customize()
1static customize(cb: CustomCallback): void
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
1Logger.customize((logger, level, args) => {2 // Custom logging implementation3});
Source
seyfert/src/common/it/logger.ts:50
noColor()
1static noColor(msg: string): string
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.