MCPcopy
hub / github.com/prisma/prisma / getActiveLogger

Function getActiveLogger

packages/query-plan-executor/src/log/context.ts:12–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10 * @throws {Error} if no logger is found in the context or if the value is not a {@link Logger}
11 */
12export function getActiveLogger(): Logger {
13 const logger = context.active().getValue(LOG_CONTEXT)
14
15 if (!logger) {
16 throw new Error('No active logger found')
17 }
18
19 if (logger instanceof Logger) {
20 return logger
21 }
22
23 throw new Error('Active logger is not an instance of Logger')
24}
25
26/**
27 * Runs a function with a new OpenTelemetry context containing the provided logger.

Callers 7

debugFunction · 0.90
queryFunction · 0.90
infoFunction · 0.90
warnFunction · 0.90
errorFunction · 0.90
context.test.tsFile · 0.90

Calls 1

getValueMethod · 0.80

Tested by

no test coverage detected