Describe the feature
I was looking to a have Method (example: func (l *logger) ColorMode(enabled bool) Interface
that allows the Logger colors
to be set after the logger has been initialized
https://github.com/go-gorm/gorm/blob/1e8baf545953dd58e2f301f4dfef5febbc12da0f/logger/logger.go#L91-L120
Motivation
I've had this use case where at times when I use the default logger, it has the Colorful
option set to true
,
and while it's great for most cases, there are times where I'll be outputting the logs to a random file,
but it shows all the control characters with it which ends up getting a bit muddy.
Seems like the only way to have this configured is by creating a new instance of the logger
with the Config.Colorful = false
.
Reading through the code, seems like there is a possibility to ensure that the default config is always respected, and the user can also disable the logger colors if needed
Related Issues
n/a
Other Notes
I can try to take a stab at it, and post my findings as a comment in the issue
Comment From: prithvijj
https://github.com/go-gorm/gorm/compare/master...prithvijj:gorm:exp/logger
This is what I had in mind, and if it looks okay, happy to open a PR for it, (although not sure what the best way for testing out the logger is in this repo)