Skip to content

Logger beta ​

Class of @v12-engine/engine

ts
export declare class Logger

A logger: it takes entries of a level and above and sends them to its sinks and its parent

Members ​

constructor ​

ts
constructor(options?: LoggerOptions);

Constructs a new instance of the Logger class

child ​

ts
child(options?: Omit<LoggerOptions, 'parent'> | LogContext): Logger;

A logger under this one: its entries carry what context adds, and are passed up here

debug ​

ts
debug(category: string, message: string, fields?: Record<string, unknown>): void;

Says a debug entry

error ​

ts
error(category: string, message: string, fields?: Record<string, unknown>): void;

Says an error entry

info ​

ts
info(category: string, message: string, fields?: Record<string, unknown>): void;

Says an info entry

level ​

ts
level: LogLevel;

The least an entry must matter to be said: what is under it is dropped here, and goes no further

log ​

ts
log(level: LogLevel, category: string, message: string, fields?: Record<string, unknown>): void;

Says an entry of the level, the category and the message, with its fields when given; dropped when the logger does not say that level

pass ​

ts
pass(entry: LogEntry): void;

Takes an entry made elsewhere (a world's, by the client that shows it; a server's, sent to a tool) as if it was said here: to this logger's sinks, and up. What it already says of its game and its tick is kept

says ​

ts
says(level: LogLevel): boolean;

Whether an entry of this level would be said: for not putting together what nobody will read

to ​

ts
to(sink: LogSink): () => void;

Sends this logger's entries, and those of every logger under it, to a sink. Returns what stops it

warn ​

ts
warn(category: string, message: string, fields?: Record<string, unknown>): void;

Says a warn entry