MCPcopy
hub / github.com/Doorman11991/smallcode / emit

Method emit

src/compiled/logger.js:13–29  ·  view source on GitHub ↗
(entry)

Source from the content-addressed store, hash-verified

11 this.service = service;
12 }
13 emit(entry) {
14 // SmallCode: only emit logs when explicitly enabled. Otherwise stays silent
15 // to avoid polluting CLI output. Set SMALLCODE_COGNITION_LOG=stdout to enable
16 // structured logs to stdout, or SMALLCODE_COGNITION_LOG=stderr for stderr.
17 const target = process.env.SMALLCODE_COGNITION_LOG;
18 if (!target)
19 return;
20 const full = {
21 timestamp: new Date().toISOString(),
22 service: this.service,
23 span_id: (0, crypto_1.randomUUID)(),
24 ...entry,
25 };
26 const fn = target === "stderr" ? console.error :
27 (entry.level === "error" || entry.level === "fatal" ? console.error : console.log);
28 fn(JSON.stringify(full));
29 }
30 info(event, fields = {}) {
31 this.emit({ level: "info", event, status: "success", trace_id: fields.trace_id || "", ...fields });
32 }

Callers 5

infoMethod · 0.95
warnMethod · 0.95
errorMethod · 0.95
debugMethod · 0.95
runMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected