Loggable
Defined in: utils.ts:167
Provides a lightweight, extensible logging mechanism with customizable formatting.
The Loggable class is designed to be extended and used for temporary logging purposes,
avoiding the memory overhead of persistent logger instances. Each instance is created
when needed and goes out of scope once used, improving performance.
(Class unmodified except for five original source functions).
Constructors
new Loggable()
new Loggable(PACKAGE): LoggableDefined in: utils.ts:168
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Properties
PACKAGE
PACKAGE: string;Defined in: utils.ts:168
Methods
note()
note(header, ...messages): voidDefined in: utils.ts:170
Logs the message to the console as a standard note.
Parameters
| Parameter | Type |
|---|---|
|
|
… |
|
Returns
void
trace()
trace(header, ...messages): voidDefined in: utils.ts:175
Logs the message to the console with a debug level.
Parameters
| Parameter | Type |
|---|---|
|
|
… |
|
Returns
void
warn()
warn(header, ...messages): voidDefined in: utils.ts:182
Logs the message to the console as a warning.
Parameters
| Parameter | Type |
|---|---|
|
|
… |
|
Returns
void
panic()
panic(header, ...messages): voidDefined in: utils.ts:187
Logs the message to the console as an error.
Parameters
| Parameter | Type |
|---|---|
|
|
… |
|
Returns
void
format()
format( header, level, codes, ... message): stringDefined in: utils.ts:201
Formats the log into a styled string suitable for console output.
The format includes the log header, timestamp, and a separator.
Modified to give the ansi codes of the background
Parameters
| Parameter | Type | Description |
|---|---|---|
|
| ‐ |
|
| ‐ |
| Ansi codes for styling | |
… |
| ‐ |
Returns
string
A formatted log string
formatLines()
formatLines(lines): stringDefined in: utils.ts:226
Formats the individual lines of the log with a consistent style.
Each line is prefixed with a vertical bar (|) for clarity.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
string
A formatted string containing all log lines
toError()
toError(lines): ErrorDefined in: utils.ts:240
Converts the log entry into an Error object.
The resulting Error will contain the concatenated lines of the log as its message.
Parameters
| Parameter | Type |
|---|---|
|
|
Returns
Error
An Error object representing the log entry