Skip to content

EventLog beta ​

Class of @v12-engine/engine/debug

ts
export declare class EventLog implements Trace

The events and hooks of the last seconds of a world, the game's own among them, with the listeners and handlers that ran on them. Hooks run often (every target search asks one), so a hook is one line a tick, with how many times. Following costs a little: it is only on while attached

Members ​

constructor ​

ts
constructor(
    seconds?: number, 
    max?: number);

Constructs a new instance of the EventLog class

attach ​

ts
attach(world: World): void;

Starts following a world

attached ​

ts
get attached(): boolean;

Whether the log is attached to a world, following what happens in it

clear ​

ts
clear(): void;

Empties the log and the hooks it is counting for the current tick

detach ​

ts
detach(): void;

Stops following it. What was logged stays

entries ​

ts
get entries(): readonly LoggedEvent[];

What was logged, oldest first. The same list, kept up to date: to read, not to keep

hook ​

ts
hook(name: string, handlers: readonly {
        id: string;
    }[], own: boolean, event: unknown): void;

Notes that the hook ran, with the ids of its handlers and whether it is a game's own; a hook run again in the same tick only adds to its count

listener ​

ts
listener(id: string): void;

Notes that the listener with this id ran on the event going out; part of Trace

max ​

ts
readonly max: number;

Lines kept at most, however short a time they took

seconds ​

ts
readonly seconds: number;

Seconds of it that are kept