feat: implement logging enhancements; add projectId and queryId to log entity; update query and logger services for improved logging; refactor query execution to support call stack tracking
This commit is contained in:
@ -19,18 +19,28 @@ export class Vm {
|
||||
private log: TLog;
|
||||
private headers?: Record<string, string>;
|
||||
private cookies?: Record<string, string>;
|
||||
private callStack = 0;
|
||||
|
||||
constructor(
|
||||
configs: {
|
||||
memoryLimit: number;
|
||||
timeLimit?: bigint;
|
||||
cpuTimeLimit?: bigint;
|
||||
modules: VModule[];
|
||||
plugins: Plugin[];
|
||||
functions: string[];
|
||||
log: TLog;
|
||||
headers?: Record<string, string>;
|
||||
cookies?: Record<string, string>;
|
||||
},
|
||||
callStack = 0
|
||||
) {
|
||||
this.callStack = callStack;
|
||||
|
||||
if (this.callStack > 5) {
|
||||
throw new Error("Maximum call stack size exceeded");
|
||||
}
|
||||
|
||||
constructor(configs: {
|
||||
memoryLimit: number;
|
||||
timeLimit?: bigint;
|
||||
cpuTimeLimit?: bigint;
|
||||
modules: VModule[];
|
||||
plugins: Plugin[];
|
||||
functions: string[];
|
||||
log: TLog;
|
||||
headers?: Record<string, string>;
|
||||
cookies?: Record<string, string>;
|
||||
}) {
|
||||
this.memoryLimit = configs.memoryLimit;
|
||||
this.modules = configs.modules;
|
||||
this.plugins = configs.plugins;
|
||||
@ -71,6 +81,7 @@ export class Vm {
|
||||
plugin.setLog(this.log);
|
||||
plugin.setHeaders(this.headers);
|
||||
plugin.setCookies(this.cookies);
|
||||
plugin.setCallStack(this.callStack);
|
||||
const result = await plugin[method](...args);
|
||||
|
||||
if (result && result.log) {
|
||||
|
||||
Reference in New Issue
Block a user