Skip to content

Conversation

@ManuelBilbao
Copy link
Contributor

Motivation

Recently changes turned off ANSI colors when TTY is not detected. This is sometimes annoying (e.g., with systemd).

Description

Add a --log.color flag (following --log.level format) with options auto (current and default behaviour), always and never

@ManuelBilbao ManuelBilbao self-assigned this Oct 23, 2025
@ManuelBilbao ManuelBilbao requested a review from a team as a code owner October 23, 2025 23:38
Copilot AI review requested due to automatic review settings October 23, 2025 23:38
@ManuelBilbao ManuelBilbao added L2 Rollup client cli Command line interface L1 Ethereum client labels Oct 23, 2025
@ethrex-project-sync ethrex-project-sync bot moved this to In Review in ethrex_l1 Oct 23, 2025
Copy link
Contributor

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 a new CLI flag --log.color to control ANSI color output in logs, addressing the issue where colors are disabled when TTY is not detected (e.g., in systemd environments). The flag supports three modes: auto (default, current behavior), always (force colors), and never (disable colors).

Key Changes:

  • Added LogColor enum with three variants: Auto, Always, and Never
  • Implemented Display and FromStr traits for the LogColor enum to support CLI parsing
  • Modified the tracing initialization logic to respect the new color mode setting

Reviewed Changes

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

File Description
cmd/ethrex/cli.rs Defines the LogColor enum, implements required traits, and adds the --log.color CLI option
cmd/ethrex/initializers.rs Updates the tracing initialization to check the new log_color option before disabling ANSI colors

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

@github-actions
Copy link

github-actions bot commented Oct 23, 2025

Lines of code report

Total lines added: 43
Total lines removed: 0
Total lines changed: 43

Detailed view
+-----------------------------------+-------+------+
| File                              | Lines | Diff |
+-----------------------------------+-------+------+
| ethrex/cmd/ethrex/cli.rs          | 620   | +41  |
+-----------------------------------+-------+------+
| ethrex/cmd/ethrex/initializers.rs | 464   | +2   |
+-----------------------------------+-------+------+

@ManuelBilbao ManuelBilbao added this pull request to the merge queue Oct 24, 2025
Merged via the queue into main with commit 4514172 Oct 24, 2025
31 checks passed
@ManuelBilbao ManuelBilbao deleted the cli_color_option branch October 24, 2025 15:34
@github-project-automation github-project-automation bot moved this from In Review to Done in ethrex_l1 Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Command line interface L1 Ethereum client L2 Rollup client

Projects

Status: Done
Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants