MCPcopy Index your code
hub / github.com/Waishnav/devspace / logEvent

Function logEvent

src/logger.ts:30–53  ·  view source on GitHub ↗
(
  config: LoggingConfig,
  level: Exclude<LogLevel, "silent">,
  event: string,
  fields: LogFields = {},
)

Source from the content-addressed store, hash-verified

28}
29
30export function logEvent(
31 config: LoggingConfig,
32 level: Exclude<LogLevel, "silent">,
33 event: string,
34 fields: LogFields = {},
35): void {
36 if (!shouldLog(config, level)) return;
37
38 const entry = {
39 ts: new Date().toISOString(),
40 level,
41 event,
42 ...fields,
43 };
44
45 const line = config.format === "pretty" ? formatPretty(entry) : JSON.stringify(entry);
46 if (level === "error") {
47 console.error(line);
48 } else if (level === "warn") {
49 console.warn(line);
50 } else {
51 console.log(line);
52 }
53}
54
55export function requestIp(req: Request, trustProxy: boolean): string | undefined {
56 if (trustProxy) {

Callers 2

logToolCallFunction · 0.85
createServerFunction · 0.85

Calls 2

shouldLogFunction · 0.85
formatPrettyFunction · 0.85

Tested by

no test coverage detected