leet.logger

A script can read the event logger's journal (Development > Logger in the menu) and see which remote calls the client made and with which arguments.

The logger records calls only while it is on. Turn it on with leet.features.set('remote_calls.event_log', true) and off again when you are done.

leet.logger.calls

TypeScript
leet.logger.calls(since?: number, limit?: number): {
    enabled: boolean,
    next: number,
    more: boolean,
    calls: Array<{
        sequence: number,
        time: string | null,
        kind: 'callRemote' | 'callRemoteUnreliable' | 'callRemoteProc',
        blocked: boolean,
        argc: number,
        wireName: string,
        name: string | null,
        argsText: string
    }>
}

Returns a page of the logged calls with a sequence above since, oldest first. When more is true, ask for the next page with since = next.

JavaScript
leet.features.set('remote_calls.event_log', true);

// ... later, after the game made some calls ...
let since = 0;
for (;;) {
    const page = leet.logger.calls(since);
    for (const call of page.calls) mp.console.logInfo(`${call.time} ${call.name ?? call.wireName} ${call.argsText}`);
    since = page.next;
    if (!page.more) break;
}

Parameters

  • since (number, optional): only calls with a greater sequence are returned. Default 0, which means everything the logger holds (up to 512 calls).
  • limit (number, optional): the most calls in one page, 1 to 100. Default 50.

Returns

FieldMeaning
enabledfalse while the logger is off; the list is then empty or holds only older calls.
nextThe sequence of the last call in the page, or since when the page is empty.
moretrue when another page waits.
callsThe page. time is the local time HH:MM:SS.mmm. name is null while the readable name is unknown and starts with ~ when it is a best guess. argsText is the formatted dump of the arguments (cut at 2 KiB, like wireName and name).

Keep in mind

  • A page holds at most limit calls and about 12 KiB of text, so a page can be shorter than limit. Keep reading until more is false.

Throws: leet: invalid since or limit (an argument is not a number or is out of range).

Next: Vehicle and entities