MCPcopy
hub / github.com/loggerhead/json4u / log

Function log

src/lib/utils.ts:116–127  ·  view source on GitHub ↗
(rawLog: (...args: any[]) => void, ...args: any[])

Source from the content-addressed store, hash-verified

114 };
115
116 const log = (rawLog: (...args: any[]) => void, ...args: any[]) => {
117 try {
118 const fixWidth = 20;
119 const stack = Error().stack!.split("\n");
120 const match = stack[3].match(pathRegex)!;
121 const fileName = match[1].replace(/\?.*$/, "").split("/").pop() ?? "";
122 const spaces = fileName.length < fixWidth ? " ".repeat(fixWidth - fileName.length) : "";
123 rawLog(t(), `[${fileName}]${spaces}\t`, ...args);
124 } catch (e) {
125 rawLog(t(), ...args);
126 }
127 };
128
129 // @ts-ignore
130 console.rawInfo = console.info.bind(console);

Callers 1

initLoggerFunction · 0.85

Calls 1

tFunction · 0.70

Tested by

no test coverage detected