You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to configure a new logger? I am thinking of using logrus to structure the logging in json format for a project, so if you have any suggestion, please recommend.
-Kartlee
The text was updated successfully, but these errors were encountered:
i am not familiar with logrus. what i did in some other project when using go-kit's logger was redirecting the output from the std lib log to the adapter gokit provides:
I think there is a better solution to implement in endless:
var logger = log.New(os.Stdout, "", 0)
var loggerDiscard = log.New(ioutil.Discard, "", 0)
// SetLogger ...
//
func SetLogger(lg *log.Logger) {
if lg == nil {
lg = loggerDiscard
}
logger = lg
}
func useLogger() {
logger.Print("foo", "bar")
}
This way I can externally controle the logger (prefix, flags, ...) or even discard as I see fit.
I use endless in a daemon and I want to eliminate the output, with the above code implemented in endless it would be possible...
Hi Folks,
Is there a way to configure a new logger? I am thinking of using logrus to structure the logging in json format for a project, so if you have any suggestion, please recommend.
-Kartlee
The text was updated successfully, but these errors were encountered: