Skip to main content

@rtorcato/js-common / logging

logging

Type Aliases

ConsoleLevel

ConsoleLevel = "log" | "info" | "warn" | "error"

Defined in: logging/index.ts:42

One of the four standard console methods used by captureConsole.

Functions

logWithTimestamp()

logWithTimestamp(message, level?): void

Defined in: logging/index.ts:6

Logs a message with a timestamp.

Parameters

message

string

The message to log.

level?

"info" | "warn" | "error"

The log level (default: 'info').

Returns

void


warn()

warn(message): void

Defined in: logging/index.ts:16

Logs a warning message.

Parameters

message

string

The warning message.

Returns

void


error()

error(message): void

Defined in: logging/index.ts:25

Logs an error message.

Parameters

message

string

The error message.

Returns

void


info()

info(message): void

Defined in: logging/index.ts:34

Logs an info message.

Parameters

message

string

The info message.

Returns

void


captureConsole()

captureConsole(callback): () => void

Defined in: logging/index.ts:49

Captures all console output and returns a function to restore it.

Parameters

callback

(type, ...args) => void

Function to call with each log message.

Returns

Restore function.

() => void