MCPcopy
hub / github.com/drizzle-team/drizzle-orm / DefaultLogger

Class DefaultLogger

drizzle-orm/src/logger.ts:19–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19export class DefaultLogger implements Logger {
20 static readonly [entityKind]: string = 'DefaultLogger';
21
22 readonly writer: LogWriter;
23
24 constructor(config?: { writer: LogWriter }) {
25 this.writer = config?.writer ?? new ConsoleLogWriter();
26 }
27
28 logQuery(query: string, params: unknown[]): void {
29 const stringifiedParams = params.map((p) => {
30 try {
31 return JSON.stringify(p);
32 } catch {
33 return String(p);
34 }
35 });
36 const paramsStr = stringifiedParams.length ? ` -- params: [${stringifiedParams.join(', ')}]` : '';
37 this.writer.write(`Query: ${query}${paramsStr}`);
38 }
39}
40
41export class NoopLogger implements Logger {
42 static readonly [entityKind]: string = 'NoopLogger';

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected