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
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.
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 greatersequenceare returned. Default0, which means everything the logger holds (up to 512 calls).limit(number, optional): the most calls in one page, 1 to 100. Default50.
Returns
| Field | Meaning |
|---|---|
enabled | false while the logger is off; the list is then empty or holds only older calls. |
next | The sequence of the last call in the page, or since when the page is empty. |
more | true when another page waits. |
calls | The 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
limitcalls and about 12 KiB of text, so a page can be shorter thanlimit. Keep reading untilmoreisfalse.
Throws: leet: invalid since or limit (an argument is not a number or is out of range).