1
0
silverbullet/plugos/syscalls/sandbox.ts

18 lines
522 B
TypeScript
Raw Normal View History

import { LogEntry } from "../sandbox.ts";
import { SysCallMapping, System } from "../system.ts";
2022-05-09 12:59:12 +00:00
export default function sandboxSyscalls(system: System<any>): SysCallMapping {
return {
"sandbox.getLogs": (): LogEntry[] => {
2022-05-09 12:59:12 +00:00
let allLogs: LogEntry[] = [];
for (const plug of system.loadedPlugs.values()) {
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;
},
};
}