2022-11-01 14:00:59 +00:00
|
|
|
import type { LogEntry } from "../sandbox.ts";
|
|
|
|
import type { SysCallMapping, System } from "../system.ts";
|
2022-05-09 12:59:12 +00:00
|
|
|
|
|
|
|
export default function sandboxSyscalls(system: System<any>): SysCallMapping {
|
|
|
|
return {
|
2022-10-10 12:50:21 +00:00
|
|
|
"sandbox.getLogs": (): LogEntry[] => {
|
2022-05-09 12:59:12 +00:00
|
|
|
let allLogs: LogEntry[] = [];
|
2022-10-10 12:50:21 +00:00
|
|
|
for (const plug of system.loadedPlugs.values()) {
|
2022-11-01 08:57:20 +00:00
|
|
|
if (plug.sandbox) {
|
|
|
|
allLogs = allLogs.concat(plug.sandbox.logBuffer);
|
|
|
|
}
|
2022-05-09 12:59:12 +00:00
|
|
|
}
|
|
|
|
allLogs = allLogs.sort((a, b) => a.date - b.date);
|
|
|
|
return allLogs;
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|