Skip to content

Feature Request: Introduce a configuration option to control ANSI color formatting in console output #3777

@d-timotijevic

Description

@d-timotijevic

Is your feature improvement request related to a problem? Please describe.

Currently, the logging output from thin-edge.io components utilizes ANSI color escape codes for formatting. While this is beneficial for visual clarity in terminals that support ANSI colors, it becomes problematic in log viewers and environments that do not. In such cases, the raw ANSI escape codes are displayed as text, making the logs difficult to read and parse, as shown in the image below.

Image

Describe the solution you'd like

To address this, it would be highly beneficial to have a configuration option to enable or disable the use of ANSI colors in the log output. This would provide users with the flexibility to adapt the logging behavior to their specific environment.

This could be implemented in the main tedge.toml configuration file, for instance, with a new setting under a [logs] section:

[logs]
color = false

Alternatively, or in addition, an environment variable could be used to control this behavior, for example:

TEDGE_COLORED_LOGS=false

Describe alternatives you've considered

One alternative is to pipe the log output through a command-line tool that strips ANSI escape codes. However, this is a manual workaround that needs to be applied every time the logs are accessed and is not an ideal solution for automated log processing and viewing in various platforms.

Additional context

The ability to control log formatting is a common feature in many command-line tools and applications. Implementing this feature would improve the usability and interoperability of thin-edge.io in a wider range of environments, from simple terminal outputs to complex log aggregation and analysis systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions