#
Class: Logger#
Constructors#
constructor+ new Logger(options?
: LoggerConstructorOptions): Logger
Creates a new Logger instance
example
#
Parameters:Name | Type |
---|---|
options? | LoggerConstructorOptions |
Returns: Logger
Defined in: index.ts:165
#
Properties#
COLORSâ–ª Readonly
Static
COLORS: object
ANSI Escape Sequences
example
#
Type declaration:Name | Type |
---|---|
BgBlack | string |
BgBlue | string |
BgCyan | string |
BgGreen | string |
BgMagenta | string |
BgRed | string |
BgWhite | string |
BgYellow | string |
Blink | string |
Bright | string |
Dim | string |
FgBlack | string |
FgBlue | string |
FgCyan | string |
FgGreen | string |
FgMagenta | string |
FgRed | string |
FgWhite | string |
FgYellow | string |
Hidden | string |
Reset | string |
Reverse | string |
Underscore | string |
Defined in: index.ts:152
#
Accessors#
logs• get logs(): Log[]
All logs that have been output by this Logger instance
example
Returns: Log[]
Defined in: index.ts:191
#
logsPath• get logsPath(): undefined | string
The output file path
example
Returns: undefined | string
Defined in: index.ts:204
• set logsPath(logsPath
: undefined | string): void
The output file path
example
#
Parameters:Name | Type |
---|---|
logsPath | undefined | string |
Returns: void
Defined in: index.ts:217
#
Methods#
errorâ–¸ error(message
: unknown): Promise<Log>
Logs a success message to the console and writes to the output file path
example
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The error message to log |
Returns: Promise<Log>
Defined in: index.ts:556
â–¸ error(message
: unknown, logOptions
: Pick<LogOptionsWithoutWrite, writeToFile>): Log
Logs an error message to the console and DOES NOT write to the output file path
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The error message to log |
logOptions | Pick<LogOptionsWithoutWrite, writeToFile> | Logging options |
Returns: Log
Defined in: index.ts:570
â–¸ error(message
: unknown, logOptions
: Pick<LogOptionsWithWrite, writeToFile | extra>): Promise<Log>
Logs an error message to the console and writes to the output file path
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The error message to log |
logOptions | Pick<LogOptionsWithWrite, writeToFile | extra> | Logging options |
Returns: Promise<Log>
Defined in: index.ts:593
#
infoâ–¸ info(message
: unknown): Promise<Log>
Logs a success message to the console and writes to the output file path
example
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The info message to log |
Returns: Promise<Log>
Defined in: index.ts:410
â–¸ info(message
: unknown, logOptions
: Pick<LogOptionsWithoutWrite, writeToFile>): Log
Logs an info message to the console and DOES NOT write to the output file path
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The info message to log |
logOptions | Pick<LogOptionsWithoutWrite, writeToFile> | Logging options |
Returns: Log
Defined in: index.ts:424
â–¸ info(message
: unknown, logOptions
: Pick<LogOptionsWithWrite, writeToFile | extra>): Promise<Log>
Logs an info message to the console and writes to the output file path
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The info message to log |
logOptions | Pick<LogOptionsWithWrite, writeToFile | extra> | Logging options |
Returns: Promise<Log>
Defined in: index.ts:447
#
logâ–¸ log(message
: unknown): Promise<Log>
Logs a message to the console and writes to the output file path
example
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The message to log |
Returns: Promise<Log>
Defined in: index.ts:239
â–¸ log(message
: unknown, logOptions
: LogOptionsWithoutWrite): Log
Logs a message to the console and DOES NOT write to the output file path
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The message to log |
logOptions | LogOptionsWithoutWrite | Logging options |
Returns: Log
Defined in: index.ts:260
â–¸ log(message
: unknown, logOptions
: LogOptionsWithWrite): Promise<Log>
Logs a message to the console and writes to the output file path
example
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The message to log |
logOptions | LogOptionsWithWrite | Logging options |
Returns: Promise<Log>
Defined in: index.ts:288
#
successâ–¸ success(message
: unknown): Promise<Log>
Logs a success message to the console and writes to the output file path
example
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The success message to log |
Returns: Promise<Log>
Defined in: index.ts:337
â–¸ success(message
: unknown, logOptions
: Pick<LogOptionsWithoutWrite, writeToFile>): Log
Logs a success message to the console and DOES NOT write to the output file path
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The success message to log |
logOptions | Pick<LogOptionsWithoutWrite, writeToFile> | Logging options |
Returns: Log
Defined in: index.ts:351
â–¸ success(message
: unknown, logOptions
: Pick<LogOptionsWithWrite, writeToFile | extra>): Promise<Log>
Logs a success message to the console and writes to the output file path
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The success message to log |
logOptions | Pick<LogOptionsWithWrite, writeToFile | extra> | Logging options |
Returns: Promise<Log>
Defined in: index.ts:374
#
warnâ–¸ warn(message
: unknown): Promise<Log>
Logs a success message to the console and writes to the output file path
example
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The warn message to log |
Returns: Promise<Log>
Defined in: index.ts:483
â–¸ warn(message
: unknown, logOptions
: Pick<LogOptionsWithoutWrite, writeToFile>): Log
Logs a warning message to the console and DOES NOT write to the output file path
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The warning message to log |
logOptions | Pick<LogOptionsWithoutWrite, writeToFile> | Logging options |
Returns: Log
Defined in: index.ts:497
â–¸ warn(message
: unknown, logOptions
: Pick<LogOptionsWithWrite, writeToFile | extra>): Promise<Log>
Logs a warning message to the console and writes to the output file path
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message | unknown | The warning message to log |
logOptions | Pick<LogOptionsWithWrite, writeToFile | extra> | Logging options |
Returns: Promise<Log>
Defined in: index.ts:520
#
writeLogsâ–¸ writeLogs(): Promise<void>
Writes the logs stored in this.logs
to the output file
example
Returns: Promise<void>
Defined in: index.ts:620
#
boldâ–¸ Static
bold(message
: unknown, afterColored?
: string): void
Logs a bold message
example
example
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
message | unknown | - | The bold message to log |
afterColored | string | "" | The optional message after the bold message (on the same line) |
Returns: void
Defined in: index.ts:705
#
coloredLogâ–¸ Static
coloredLog(color
: Reset | Bright | Dim | Underscore | Blink | Reverse | Hidden | FgBlack | FgRed | FgGreen | FgYellow | FgBlue | FgMagenta | FgCyan | FgWhite | BgBlack | BgRed | BgGreen | BgYellow | BgBlue | BgMagenta | BgCyan | BgWhite, message
: unknown, afterColored?
: string, consoleLevel?
: log | warn | error): void
Logs a colored message to the console
example
example
example
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
color | Reset | Bright | Dim | Underscore | Blink | Reverse | Hidden | FgBlack | FgRed | FgGreen | FgYellow | FgBlue | FgMagenta | FgCyan | FgWhite | BgBlack | BgRed | BgGreen | BgYellow | BgBlue | BgMagenta | BgCyan | BgWhite | - | The color to log in |
message | unknown | - | The message to log |
afterColored | string | "" | The optional message after the colored message (on the same line) |
consoleLevel | log | warn | error | "log" | The console level to use (log, warn, or error) |
Returns: void
Defined in: index.ts:679
#
errorâ–¸ Static
error(message
: unknown, afterColored?
: string): void
Logs an error message in red
example
example
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
message | unknown | - | The error message to log |
afterColored | string | "" | The optional message after the error message (on the same line) |
Returns: void
Defined in: index.ts:781
#
infoâ–¸ Static
info(message
: unknown, afterColored?
: string): void
Logs an info message in blue
example
example
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
message | unknown | - | The info message to log |
afterColored | string | "" | The optional message after the info message (on the same line) |
Returns: void
Defined in: index.ts:743
#
lineâ–¸ Static
line(): void
Logs an empty line to the console
example
Returns: void
Defined in: index.ts:654
#
logâ–¸ Static
log(message?
: unknown, ...optionalParams
: any[]): void
Logs to the console
example
example
#
Parameters:Name | Type | Description |
---|---|---|
message? | unknown | The message to log |
...optionalParams | any[] | Substitution strings |
Returns: void
Defined in: index.ts:641
#
successâ–¸ Static
success(message
: unknown, afterColored?
: string): void
Logs a success message in green
example
example
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
message | unknown | - | The success message to log |
afterColored | string | "" | The optional message after the success message (on the same line) |
Returns: void
Defined in: index.ts:724
#
warnâ–¸ Static
warn(message
: unknown, afterColored?
: string): void
Logs a warning message in yellow
example
example
#
Parameters:Name | Type | Default value | Description |
---|---|---|---|
message | unknown | - | The warning message to log |
afterColored | string | "" | The optional message after the warning message (on the same line) |
Returns: void
Defined in: index.ts:762