Log Module Reference
Documentation / log
LogOptions
Defined in: log.ts:75
Properties
style?
string
| string
[]
CSS style string or array of CSS strings for browser console styling
color?
| "reset"
| "black"
| "red"
| "green"
| "yellow"
| "blue"
| "magenta"
| "cyan"
| "white"
| "gray"
| "brightRed"
| "brightGreen"
| "brightYellow"
| "brightBlue"
| "brightMagenta"
| "brightCyan"
| "brightWhite"
| "bgRed"
| "bgGreen"
| "bgYellow"
| "bgBlue"
| "bgMagenta"
| "bgCyan"
| "bgWhite"
| "bgGray"
Optional color name or code for terminal environments
hideInProduction?
boolean
If true, hides log in production (auto-detects by hostname if undefined)
startSpinner?
boolean
Start a spinner (for CLI tools, optional)
stopSpinner?
boolean
Stop a spinner (for CLI tools, optional)
colors
const colors: object;
Defined in: log.ts:89
ANSI escape codes for terminal colors when running in Node.js
Type declaration
reset
string
"\x1b[0m"
‐
black
string
"\x1b[30m"
‐
red
string
"\x1b[31m"
‐
green
string
"\x1b[32m"
‐
yellow
string
"\x1b[33m"
‐
blue
string
"\x1b[34m"
‐
magenta
string
"\x1b[35m"
‐
cyan
string
"\x1b[36m"
‐
white
string
"\x1b[37m"
‐
gray
string
"\x1b[90m"
‐
brightRed
string
"\x1b[91m"
Bright variants
brightGreen
string
"\x1b[92m"
‐
brightYellow
string
"\x1b[93m"
‐
brightBlue
string
"\x1b[94m"
‐
brightMagenta
string
"\x1b[95m"
‐
brightCyan
string
"\x1b[96m"
‐
brightWhite
string
"\x1b[97m"
‐
bgRed
string
"\x1b[41m"
Background colors (optional)
bgGreen
string
"\x1b[42m"
‐
bgYellow
string
"\x1b[43m"
‐
bgBlue
string
"\x1b[44m"
‐
bgMagenta
string
"\x1b[45m"
‐
bgCyan
string
"\x1b[46m"
‐
bgWhite
string
"\x1b[47m"
‐
bgGray
string
"\x1b[100m"
‐
log()
function log(message: string, options: LogOptions): boolean;
Defined in: log.ts:13
Colorized Log With JSON Structure
Logs messages to the console with custom styling,
prints JSON with description of structure layout,
and showing debug output in development only.
Parameters
message
string
""
The message to log. If an object is provided, it will be stringified.
options
{}
‐
Returns
boolean
printJSONStructure()
function printJSONStructure(obj: any, indent: number): string;
Defined in: log.ts:157
Creates a colored visualization of a JSON object's structure Shows the shape and types of the data rather than actual values Recursively processes nested objects and arrays
Parameters
obj
any
undefined
indent
number
0
Returns
string
showAlert()
function showAlert(msg: any): void;
Defined in: log.ts:228
Shows message in a modal overlay with scrollable message stack and is easier to dismiss unlike alert() which blocks window. Creates a semi-transparent overlay with a white box containing the message.
Parameters
msg
any
The message to display
Returns
void
setupDevTools()
function setupDevTools(): void;
Defined in: log.ts:266
Sets up development tools for debugging API requests Adds a keyboard shortcut (Ctrl+I) that shows a modal with request history Each request entry shows:
- Request path
- Request details
- Response data
- Timestamp
Returns
void
showSpinnerInTerminal()
function showSpinnerInTerminal(text: any): (success: string) => void;
Defined in: log.ts:297
Displays an animated spinner in the terminal with the provided text. The spinner animates in-place until the returned function is called, which stops the spinner and prints a success message.
Parameters
text
any
The text to display next to the spinner animation.
Returns
Stop function with optional message.
(success: string): void;
Parameters
success
string
"✔ Done!"
Returns
void
Example
const stopSpinner = showSpinnerInTerminal('Downloading...');
setTimeout(() => {
stopSpinner('Success!');
}, 2000);