Skip to content

When redirected, ignore cli defaults (so we get full json without needing to set LOGGER_IGNORE_CLI_MODE) and NO_COLOR support#76

Merged
ldemailly merged 4 commits intomainfrom
non_console_no_cli_defaults
Oct 4, 2025
Merged

When redirected, ignore cli defaults (so we get full json without needing to set LOGGER_IGNORE_CLI_MODE) and NO_COLOR support#76
ldemailly merged 4 commits intomainfrom
non_console_no_cli_defaults

Conversation

@ldemailly
Copy link
Copy Markdown
Member

@ldemailly ldemailly commented Oct 4, 2025

also

fixes #72

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the NO_COLOR environment variable and improves the behavior of SetDefaultsForClientTools() when output is redirected to non-console destinations. The changes ensure that color output is properly disabled when NO_COLOR is set and that client tool defaults are only applied when actually logging to a console.

  • Added ConsoleLogging field to LogConfig to track whether output is going to a terminal
  • Implemented NO_COLOR environment variable support for disabling colors
  • Modified SetDefaultsForClientTools() to skip configuration when output is redirected

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
logger.go Added ConsoleLogging field, implemented NO_COLOR support, and modified SetDefaultsForClientTools() behavior
console_logging.go Updated SetColorMode() to set ConsoleLogging field and modified ColorMode() to use cached value
logger_test.go Added test setup to force console logging mode and updated help text expectations
levelsDemo/levels.go Added explanatory comments about SetDefaultsForClientTools() behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ldemailly ldemailly changed the title Non console no cli defaults and NO_COLOR support When redirected, ignore cli defaults (so we get full json without needing to set LOGGER_IGNORE_CLI_MODE) and NO_COLOR support Oct 4, 2025
@ldemailly ldemailly requested a review from Copilot October 4, 2025 03:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ldemailly ldemailly merged commit 5b8969d into main Oct 4, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add support for NO_COLOR

2 participants