Registry / testing / drizzle-query-logger

drizzle-query-logger

JSON →
library1.1.2jsnpmunverified

Enhanced query logger for Drizzle ORM that replaces the default plain text logging with color-coded, syntax-highlighted output including icons for query types (SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER), table name extraction, parameter formatting, timestamps, and query numbering. Version 1.1.2 is the latest stable release, updated regularly. Peer dependencies are drizzle-orm >=0.44.3 <1.0.0 and TypeScript 5. Differentiators: fully typed (implements Drizzle's Logger interface), uses box-drawing characters for structured display, and supports custom logging functions for integration with external systems like Winston or Pino.

npm install drizzle-query-logger
INSTALL
IMPORT
SIG · DRIZZLE-QUERY-LOGG
D
drizzle-query-logger
testingjavascriptv1.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EnhancedQueryLogger
import { EnhancedQueryLogger } from 'drizzle-query-logger'
const EnhancedQueryLogger = require('drizzle-query-logger')
ESM-only; CommonJS require() will fail. Use named import.
LoggerOptions
import type { LoggerOptions } from 'drizzle-query-logger'
import { LoggerOptions } from 'drizzle-query-logger'
Type export only, use 'import type' to avoid runtime error.
EnhancedQueryLogger (default import)
import EnhancedQueryLogger from 'drizzle-query-logger'
const logger = require('drizzle-query-logger').default
Default export exists but named is preferred. Requires esModuleInterop for TypeScript.

Shows basic setup: create a Drizzle ORM instance with the enhanced logger, connecting to an SQLite in-memory database.

import { drizzle } from 'drizzle-orm/libsql'; import { createClient } from '@libsql/client'; import { EnhancedQueryLogger } from 'drizzle-query-logger'; const client = createClient({ url: ':memory:' }); export const db = drizzle(client, { logger: new EnhancedQueryLogger(), }); // Example query const result = await db.select().from(usersTable);
Debug
Known issues
gotchaPeer dependency version mismatch: drizzle-orm must be >=0.44.3 and <1.0.0. Using older versions may break the Logger interface.
fix
Update drizzle-orm to >=0.44.3 <1.0.0 or use a compatible version.
affects: <0.44.3 || >=1.0.0
gotchaTypeScript peer dependency is version 5. Using TypeScript 4.x may cause type errors.
fix
Install TypeScript 5 or later (npm install -D typescript@^5).
affects: <5.0.0
gotchaThe logger only works when passed to the Drizzle ORM client via the 'logger' option. Using it standalone or with other ORMs will not produce logging.
fix
Ensure you pass the logger instance to drizzle() as shown in documentation.
affects: *
gotchaCustom log function must accept a string parameter. Passing a function that expects other types may cause silent failures.
fix
Define log function as (message: string) => void.
affects: *
Errors
Common errors & fixes
TypeError: drizzle_orm_logger_1.EnhancedQueryLogger is not a constructor
Using named import from CommonJS require() which doesn't contain the default export correctly.
fix
Change 'const { EnhancedQueryLogger } = require('drizzle-query-logger')' to 'import { EnhancedQueryLogger } from 'drizzle-query-logger'
Module "drizzle-query-logger" has no exported member 'LoggerOptions'
Attempting to import LoggerOptions as a runtime value instead of a type.
fix
Use 'import type { LoggerOptions } from 'drizzle-query-logger'' instead of 'import { LoggerOptions } from 'drizzle-query-logger''
Cannot find module 'drizzle-query-logger' or its corresponding type declarations
Package not installed or TypeScript cannot resolve the module due to missing types or tsconfig settings.
fix
Run 'npm install drizzle-query-logger' and ensure 'moduleResolution' is set to 'node16' or 'bundler' in tsconfig.json
Parameter 'message' implicitly has 'any' type
Using custom log function without type annotation for the message parameter.
fix
Add type: (message: string) => void for the log option.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies
drizzle-ormrequiredPeer dependency: implements Drizzle's Logger interface; requires drizzle-orm >=0.44.3 <1.0.0
typescriptoptionalPeer dependency: ships TypeScript definitions; requires TypeScript 5+ for compilation
Agent activity
4 hits · last 30 days
node
4
Resources
drizzle-query-logger — npm install drizzle-query-logger · libregistry