MCPcopy Index your code
hub / github.com/volcengine/OpenViking / createLogger

Function createLogger

examples/codex-memory-plugin/scripts/debug-log.mjs:45–64  ·  view source on GitHub ↗
(hookName, overrideCfg)

Source from the content-addressed store, hash-verified

43const noop = () => {};
44
45export function createLogger(hookName, overrideCfg) {
46 const c = overrideCfg || cfg();
47 if (!c.debug) return { log: noop, logError: noop };
48
49 const logPath = c.debugLogPath;
50 ensureDir(logPath);
51
52 function log(stage, data) {
53 writeLine(logPath, { ts: localISO(), hook: hookName, stage, data });
54 }
55
56 function logError(stage, err) {
57 const error = err instanceof Error
58 ? { message: err.message, stack: err.stack }
59 : String(err);
60 writeLine(logPath, { ts: localISO(), hook: hookName, stage, error });
61 }
62
63 return { log, logError };
64}

Callers 5

auto-capture.mjsFile · 0.90
auto-recall.mjsFile · 0.90
auto-capture.mjsFile · 0.50

Calls 2

cfgFunction · 0.70
ensureDirFunction · 0.70

Tested by

no test coverage detected