[PR #4402] [MERGED] feat(logger): option to disable colors #30964

Closed
opened 2026-04-17 21:56:17 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4402
Author: @martiinii
Created: 9/3/2025
Status: Merged
Merged: 9/11/2025
Merged by: @himself65

Base: canaryHead: feat/logger-colors-option


📝 Commits (10+)

  • 15f4d71 feat(logger): add color configuration option for default logger implementation
  • 6be7d20 docs: add disableColors option to logger API reference
  • e6a838f feat(logger): use TTY color depth fn based on env to determine default value for color setting
  • 615c42b docs: clarify default behavior of disableColors option in logger API reference
  • e6ea266 fix(logger): replace direct call to process.stdout.getColorDepth with fn from Node.js TTY internals
  • 1e28308 fix(logger): use true color depth for Windows users
  • 49dbe0e refactor(logger): remove unused OSRelease variable from color-depth utility
  • cb65b4c Merge branch 'canary' into feat/logger-colors-option
  • a84ee94 docs: update
  • 169b302 fix: lazy

📊 Changes

3 files changed (+198 additions, -7 deletions)

View changed files

📝 docs/content/docs/reference/options.mdx (+2 -0)
packages/better-auth/src/utils/color-depth.ts (+172 -0)
📝 packages/better-auth/src/utils/logger.ts (+24 -7)

📄 Description

This PR adds option to disable colors from default logger implementation.
I've made this change because convex doesn't support colors in logs (using https://convex-better-auth.netlify.app/)
Default logger implementations logs look like this:
image
image

In this environment colors are not needed nor supported in convex dashboard.

No breaking changes introduces, only optional disableColors property for logger.
I have found no issues or discussions for this setting


Summary by cubic

Adds a disableColors option to the default logger so you can turn off ANSI colors in environments that don’t support them (e.g., Convex dashboard). Default behavior is unchanged; no breaking changes.

  • New Features
    • logger.disableColors (default: false) to output plain-text logs without colors
    • Docs updated to include the new option in the logger configuration

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4402 **Author:** [@martiinii](https://github.com/martiinii) **Created:** 9/3/2025 **Status:** ✅ Merged **Merged:** 9/11/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `feat/logger-colors-option` --- ### 📝 Commits (10+) - [`15f4d71`](https://github.com/better-auth/better-auth/commit/15f4d71192dcf8313f835bfc02c04344cd73c9ab) feat(logger): add color configuration option for default logger implementation - [`6be7d20`](https://github.com/better-auth/better-auth/commit/6be7d20e73463185585491329a741e2eba4f1adc) docs: add disableColors option to logger API reference - [`e6a838f`](https://github.com/better-auth/better-auth/commit/e6a838ff9bc06748912efefd47457f0d31358d12) feat(logger): use TTY color depth fn based on env to determine default value for color setting - [`615c42b`](https://github.com/better-auth/better-auth/commit/615c42b4f34f07c8834d4cab7d429da96567893a) docs: clarify default behavior of disableColors option in logger API reference - [`e6ea266`](https://github.com/better-auth/better-auth/commit/e6ea266e4e7bfadeecad15a9399d5c72814ace13) fix(logger): replace direct call to process.stdout.getColorDepth with fn from Node.js TTY internals - [`1e28308`](https://github.com/better-auth/better-auth/commit/1e2830836866299f94e64974177d299e92460a14) fix(logger): use true color depth for Windows users - [`49dbe0e`](https://github.com/better-auth/better-auth/commit/49dbe0e5da8ecbf5f366f51c1ab9fd2c8bb2687a) refactor(logger): remove unused OSRelease variable from color-depth utility - [`cb65b4c`](https://github.com/better-auth/better-auth/commit/cb65b4c53435533075466ce9713b3128d59fdd4a) Merge branch 'canary' into feat/logger-colors-option - [`a84ee94`](https://github.com/better-auth/better-auth/commit/a84ee945fa1479778f85510475dcd78361e94528) docs: update - [`169b302`](https://github.com/better-auth/better-auth/commit/169b3023ebb1ca2d59467e1ec8414e6718ec9824) fix: lazy ### 📊 Changes **3 files changed** (+198 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/reference/options.mdx` (+2 -0) ➕ `packages/better-auth/src/utils/color-depth.ts` (+172 -0) 📝 `packages/better-auth/src/utils/logger.ts` (+24 -7) </details> ### 📄 Description This PR adds option to disable colors from default logger implementation. I've made this change because convex doesn't support colors in logs (using https://convex-better-auth.netlify.app/) Default logger implementations logs look like this: <img width="711" height="112" alt="image" src="https://github.com/user-attachments/assets/fbcad63c-4df2-4f48-bdec-5348923b70d7" /> <img width="991" height="331" alt="image" src="https://github.com/user-attachments/assets/24119a02-a7b4-47bf-a6d8-7b5146bb452c" /> In this environment colors are not needed nor supported in convex dashboard. No breaking changes introduces, only optional `disableColors` property for logger. I have found no issues or discussions for this setting <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds a disableColors option to the default logger so you can turn off ANSI colors in environments that don’t support them (e.g., Convex dashboard). Default behavior is unchanged; no breaking changes. - New Features - logger.disableColors (default: false) to output plain-text logs without colors - Docs updated to include the new option in the logger configuration <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-17 21:56:17 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#30964