Skip to content

fix: strip ANSI color codes from log file output#164

Closed
jjjkkll157 wants to merge 1 commit into
Qix-:masterfrom
jjjkkll157:master
Closed

fix: strip ANSI color codes from log file output#164
jjjkkll157 wants to merge 1 commit into
Qix-:masterfrom
jjjkkll157:master

Conversation

@jjjkkll157

Copy link
Copy Markdown

Fixes #87 - strip ANSI escape codes from log file output when using FileHandler or non-TTY StreamHandler.

When logging.exception() writes to a FileHandler or non-TTY
StreamHandler, the ANSI escape codes for syntax highlighting
are now stripped automatically. Terminal output remains
colored as before.

- Add optional 'colored' parameter to format_exception()
- Detect non-TTY streams in log.py and pass colored=False
- Preserve existing colored stderr behavior

Fixes #87
@jjjkkll157 jjjkkll157 closed this by deleting the head repository Jul 18, 2026
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.

Logged exceptions shouldn't contain colour

1 participant