MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / loggerWithContext

Function loggerWithContext

web/src/util/logger.ts:171–188  ·  view source on GitHub ↗
(
  context: ParamsOf<LoggerWithContextFn>,
)

Source from the content-addressed store, hash-verified

169) as Record<LogLevel, pino.LogFn>
170
171export function loggerWithContext(
172 context: ParamsOf<LoggerWithContextFn>,
173): ReturnType<LoggerWithContextFn> {
174 const mergeData = (data: LogData) => ({
175 ...context,
176 ...(typeof data === 'object' && data !== null ? data : { data }),
177 })
178 return {
179 debug: (data: LogData, msg?: string, ...args: LogArgs) =>
180 logger.debug(mergeData(data), msg, ...args),
181 info: (data: LogData, msg?: string, ...args: LogArgs) =>
182 logger.info(mergeData(data), msg, ...args),
183 warn: (data: LogData, msg?: string, ...args: LogArgs) =>
184 logger.warn(mergeData(data), msg, ...args),
185 error: (data: LogData, msg?: string, ...args: LogArgs) =>
186 logger.error(mergeData(data), msg, ...args),
187 }
188}

Callers 4

requireUserFromApiKeyFunction · 0.85
postChatCompletionsFunction · 0.85
postAgentRunsFunction · 0.85
postAgentRunsStepsFunction · 0.85

Calls 1

mergeDataFunction · 0.85

Tested by

no test coverage detected