{"id":30039312,"url":"https://github.com/max-programming/drizzle-query-logger","last_synced_at":"2025-08-07T01:41:47.798Z","repository":{"id":306650499,"uuid":"1026858680","full_name":"max-programming/drizzle-query-logger","owner":"max-programming","description":"A beautiful, enhanced logger for Drizzle ORM that transforms your SQL queries into visually appealing, color-coded output with syntax highlighting, icons, and detailed formatting.","archived":false,"fork":false,"pushed_at":"2025-07-26T20:27:24.000Z","size":528,"stargazers_count":16,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-26T23:21:59.014Z","etag":null,"topics":["drizzle","drizzle-orm","logger","logging","query"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/drizzle-query-logger","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/max-programming.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-26T19:05:51.000Z","updated_at":"2025-07-26T23:19:39.000Z","dependencies_parsed_at":"2025-07-26T23:22:00.645Z","dependency_job_id":"0c9837ee-6d95-4a1b-a13a-0b7377a880b4","html_url":"https://github.com/max-programming/drizzle-query-logger","commit_stats":null,"previous_names":["max-programming/drizzle-query-logger"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/max-programming/drizzle-query-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/max-programming%2Fdrizzle-query-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/max-programming%2Fdrizzle-query-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/max-programming%2Fdrizzle-query-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/max-programming%2Fdrizzle-query-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/max-programming","download_url":"https://codeload.github.com/max-programming/drizzle-query-logger/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/max-programming%2Fdrizzle-query-logger/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269185744,"owners_count":24374629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-06T02:00:09.910Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["drizzle","drizzle-orm","logger","logging","query"],"created_at":"2025-08-07T01:41:46.027Z","updated_at":"2025-08-07T01:41:47.769Z","avatar_url":"https://github.com/max-programming.png","language":"TypeScript","readme":"# 🎨 drizzle-query-logger\n\nA beautiful, enhanced logger for Drizzle ORM that transforms your SQL queries into visually appealing, color-coded output with syntax highlighting, icons, and detailed formatting.\n\n## 📸 Before vs After\n\n### Before (Default Drizzle Logger)\n![Before - Default Drizzle Logger](./images/before.png)\n\n### After (Enhanced Query Logger)\n![After - Enhanced Query Logger](./images/after.png)\n\n*See the dramatic difference! The enhanced logger transforms plain SQL output into beautifully formatted, color-coded queries with syntax highlighting, icons, and structured parameter display.*\n\n## ✨ Features\n\n- 🎨 **Beautiful formatting** with box-drawing characters and colors\n- 🔍 **SQL syntax highlighting** with keyword colorization\n- 📊 **Query type detection** with specific colors and icons\n- 🏷️ **Table name extraction** and highlighting\n- 📝 **Parameter formatting** with type-specific colors\n- ⏰ **Timestamps** for each query\n- 🔢 **Query numbering** to track execution order\n- ⚙️ **Configurable** logging output\n\n## 📦 Installation\n\n```bash\nnpm install drizzle-query-logger\n```\n\n```bash\nyarn add drizzle-query-logger\n```\n\n```bash\npnpm add drizzle-query-logger\n```\n\n```bash\nbun add drizzle-query-logger\n```\n\n## 🚀 Usage\n\n### Basic Usage\n\n```typescript\nimport Database from 'better-sqlite3';\nimport { drizzle } from 'drizzle-orm/better-sqlite3';\nimport { EnhancedQueryLogger } from 'drizzle-query-logger';\n\nconst client = new Database(':memory:');\nexport const db = drizzle(client, {\n  logger: new EnhancedQueryLogger(),\n});\n\n// Your queries will now be beautifully logged!\nconst users = await db.select().from(usersTable);\n```\n\n### With Custom Logger Function\n\n```typescript\nimport { EnhancedQueryLogger } from 'drizzle-query-logger';\n\nconst logger = new EnhancedQueryLogger({\n  log: (message) =\u003e {\n    // Send to your preferred logging service\n    console.log(message);\n    // or use your custom logger\n    // winston.info(message);\n    // pino.info(message);\n  }\n});\n\nexport const db = drizzle(client, { logger });\n```\n\n## 🎯 Query Types \u0026 Icons\n\nThe logger automatically detects and styles different query types:\n\n| Query Type | Icon | Color  |\n|------------|------|--------|\n| SELECT     | 🔍   | Green  |\n| INSERT     | 📝   | Blue   |\n| UPDATE     | ✏️   | Yellow |\n| DELETE     | 🗑️   | Red    |\n| CREATE     | 🏗️   | Magenta|\n| DROP       | 💥   | Red    |\n| ALTER      | 🔧   | Cyan   |\n| OTHER      | ⚡   | White  |\n\n## 🛠️ Configuration\n\n### Constructor Options\n\n```typescript\ninterface LoggerOptions {\n  log?: (message: string) =\u003e void;\n}\n```\n\n- **`log`**: Custom logging function (default: `console.log`)\n\n### Example with Custom Configuration\n\n```typescript\nconst logger = new EnhancedQueryLogger({\n  log: (message) =\u003e {\n    // Custom logging logic\n    if (process.env.NODE_ENV === 'development') {\n      console.log(message);\n    } else {\n      // Send to logging service in production\n      yourLoggingService.debug(message);\n    }\n  }\n});\n```\n\n## 🎨 Color Scheme\n\nThe logger uses a carefully chosen color scheme for optimal readability:\n\n- **Keywords**: Blue (SELECT, FROM, WHERE, etc.)\n- **Strings**: Green\n- **Numbers**: Cyan\n- **Booleans**: Yellow\n- **Objects**: Magenta\n- **Null values**: Dimmed\n- **Table names**: Yellow\n- **Framework elements**: Gray with cyan accents\n\n## 🔧 TypeScript Support\n\nThis package is written in TypeScript and provides full type definitions. It implements Drizzle's `Logger` interface:\n\n```typescript\nimport type { Logger } from 'drizzle-orm/logger';\n\nexport class EnhancedQueryLogger implements Logger {\n  logQuery(query: string, params: unknown[]): void;\n}\n```\n\n## 📋 Requirements\n\n- **Node.js**: 16+ \n- **TypeScript**: 5+ (peer dependency)\n- **Drizzle ORM**: Compatible with all recent versions\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## 📄 License\n\nMIT License - see the [LICENSE](LICENSE) file for details.\n\n## 🙏 Acknowledgments\n\nBuilt for the [Drizzle ORM](https://orm.drizzle.team/) ecosystem.\n\n## ⭐ Star History\n\n## Star History\n\n\u003ca href=\"https://www.star-history.com/#max-programming/drizzle-query-logger\u0026Date\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/svg?repos=max-programming/drizzle-query-logger\u0026type=Date\u0026theme=dark\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/svg?repos=max-programming/drizzle-query-logger\u0026type=Date\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/svg?repos=max-programming/drizzle-query-logger\u0026type=Date\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmax-programming%2Fdrizzle-query-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmax-programming%2Fdrizzle-query-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmax-programming%2Fdrizzle-query-logger/lists"}