1
0
silverbullet/packages/plugos/syscalls/sandbox.ts

16 lines
492 B
TypeScript
Raw Normal View History

2022-05-09 12:59:12 +00:00
import { LogEntry } from "../sandbox";
import { SysCallMapping, System } from "../system";
export default function sandboxSyscalls(system: System<any>): SysCallMapping {
return {
"sandbox.getLogs": async (ctx): Promise<LogEntry[]> => {
let allLogs: LogEntry[] = [];
for (let plug of system.loadedPlugs.values()) {
allLogs = allLogs.concat(plug.sandbox.logBuffer);
}
allLogs = allLogs.sort((a, b) => a.date - b.date);
return allLogs;
},
};
}