MCPcopy Create free account
hub / github.com/altic-dev/Pilot / formatLog

Function formatLog

src/lib/logger.ts:15–33  ·  view source on GitHub ↗
(level: LogLevel, message: string, data?: unknown)

Source from the content-addressed store, hash-verified

13}
14
15function formatLog(level: LogLevel, message: string, data?: unknown): LogData {
16 const logData: LogData = {
17 level,
18 message,
19 timestamp: new Date().toISOString(),
20 };
21
22 if (data instanceof Error) {
23 logData.error = {
24 message: data.message,
25 stack: data.stack,
26 cause: data.cause,
27 };
28 } else if (data !== undefined) {
29 logData.data = data;
30 }
31
32 return logData;
33}
34
35export const logger = {
36 info: (message: string, data?: unknown) => {

Callers 1

logger.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected