-
Notifications
You must be signed in to change notification settings - Fork 43
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
Fail-Safe error handling for AutoColor feature #122
Comments
Hi! Looks like the unix version of the colorization code is too strict, at the very least. It should be allowing any writer, not just *os.Files. That being said, I think your question is more about what AutoColor should do and if it should, if colorization is not available on the output, simply disable colorization. That seems like better logic than we have today. |
evanphx
added a commit
that referenced
this issue
Jan 26, 2023
Cleanup AutoColor to make it never fail, instead do it's best to activate color if possible only. Fixes #122
evanphx
added a commit
that referenced
this issue
Jan 26, 2023
Cleanup AutoColor to make it never fail, instead do it's best to activate color if possible only. Fixes #122
evanphx
added a commit
that referenced
this issue
Jan 26, 2023
Cleanup AutoColor to make it never fail, instead do it's best to activate color if possible only. Fixes #122
evanphx
added a commit
that referenced
this issue
Jan 26, 2023
Cleanup AutoColor to make it never fail, instead do it's best to activate color if possible only. Fixes #122
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi folks,
I am using
hclog
in a project and instantiate the logger with a customio.Writer
, which should be fine according to the struct:go-hclog/logger.go
Line 246 in fb16e2d
If
ColorOption
is set toAutoColor
, we get only a collored output, ifOutput
from the previous line is a trueio.File
go-hclog/logger.go
Lines 273 to 275 in fb16e2d
But, if
Output
is not anio.File
,hclog
panics, instead of a fail-safe operation and omitting colouring.go-hclog/colorize_unix.go
Line 20 in fb16e2d
go-hclog/intlogger.go
Lines 879 to 887 in fb16e2d
As a fail-safe option, we can always switch to
ColorOff
, instead of panic.go-hclog/logger.go
Line 83 in fb16e2d
Or, might i miss something?
The text was updated successfully, but these errors were encountered: