Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Color Logging for Error Messages #1878

Merged
merged 1 commit into from
Feb 4, 2024

Conversation

cubxxw
Copy link
Contributor

@cubxxw cubxxw commented Feb 4, 2024

This PR introduces color logging for error messages in the openim::log::error function. By incorporating red color to the error logs, it aims to enhance readability and make it easier for developers to identify and debug errors in a sea of console output. The modification utilizes ANSI color codes to apply red color to both the initial error message and any subsequent messages passed to the function. This feature is implemented in a backward-compatible manner, ensuring that existing functionality remains unaffected while providing an optional visual cue for error logging.

Key Changes:

  • Defined ANSI color codes for red and no color (reset) within the openim::log::error function.
  • Applied these color codes to the error messages output to ensure they are displayed in red on compatible terminals.
  • Ensured that the color is reset to the default after the error message is logged to avoid affecting the terminal's subsequent output color.

This change is a step towards improving the developer experience by making log messages more informative and easier to navigate.

Copy link

codecov bot commented Feb 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8729f90) 5.32% compared to head (56e0d7a) 5.32%.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1878   +/-   ##
=====================================
  Coverage   5.32%   5.32%           
=====================================
  Files         43      43           
  Lines       3829    3829           
=====================================
  Hits         204     204           
  Misses      3612    3612           
  Partials      13      13           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@openimbot openimbot added this pull request to the merge queue Feb 4, 2024
Merged via the queue into openimsdk:main with commit 311d422 Feb 4, 2024
26 checks passed
@github-actions github-actions bot added this to the v3.1 milestone Feb 4, 2024
@openimsdk openimsdk locked and limited conversation to collaborators Feb 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants