MCPcopy Create free account
hub / github.com/MiniMax-AI/OpenRoom / formatLogLine

Function formatLogLine

apps/webuiapps/src/lib/logPlugin.ts:33–42  ·  view source on GitHub ↗
(body: LogBody)

Source from the content-addressed store, hash-verified

31 * Format a single log line using local time (consistent with file name).
32 */
33export function formatLogLine(body: LogBody): string {
34 const d = new Date(body.ts);
35 const time =
36 `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ` +
37 `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}.${pad3(d.getMilliseconds())}`;
38 const argsStr = body.args
39 .map((a) => (a !== null && typeof a === 'object' ? JSON.stringify(a) : String(a)))
40 .join(' ');
41 return `${time} [${body.level.toUpperCase()}] [${body.tag}] ${argsStr}`;
42}
43
44type FsLike = Pick<typeof fsType, 'appendFileSync' | 'existsSync' | 'mkdirSync'>;
45

Callers 2

logPlugin.test.tsFile · 0.90
createLogMiddlewareFunction · 0.85

Calls 2

padFunction · 0.85
pad3Function · 0.85

Tested by

no test coverage detected