Skip to content

Console ​

A custom console wrapper class to provide convenience methods for logging. It also ships with a static formatting template method to format messages.

Todo ​

allow setting a log level to filter messages

Example ​

Using the format method to create a formatted message:

ts
console.log(Console.f`This is a message with a <code>formatted</code> part.`);

Constructors ​

Constructor ​

ts
new Console(ctor: Console): Console;

Parameters ​

ctor ​

Console

Returns ​

Console

Properties ​

f ​

ts
f: (raw: TemplateStringsArray, ...values: unknown[]) => string[] = Console.f;

Parameters ​

raw ​

TemplateStringsArray

values ​

...unknown[]

Returns ​

string[]

Methods ​

error() ​

ts
error(...message: unknown[]): void;

Parameters ​

message ​

...unknown[]

Returns ​

void


info() ​

ts
info(...message: unknown[]): void;

Parameters ​

message ​

...unknown[]

Returns ​

void


log() ​

ts
log(...message: unknown[]): void;

Parameters ​

message ​

...unknown[]

Returns ​

void


warn() ​

ts
warn(...message: unknown[]): void;

Parameters ​

message ​

...unknown[]

Returns ​

void


f() ​

ts
static f(raw: TemplateStringsArray, ...values: unknown[]): string[];

Parameters ​

raw ​

TemplateStringsArray

values ​

...unknown[]

Returns ​

string[]