machinery
machinery copied to clipboard
Is there an example or some instruction for custom logger with zap?
It is complicated to use zap with custom logger since each level of machinery has its own logger, and zap logger set level by method, like Errorf()
and Infoln()
I wonder if there are already some solutions or references.
Thanks a lot!
any solutions for this ? :(
maybe you can use machinery/v1/log/Set(l logging.LoggerInterface)?
maybe you can use machinery/v1/log/Set(l logging.LoggerInterface)?
// Set sets a custom logger for all log levels
func Set(l logging.LoggerInterface) {
DEBUG = l
INFO = l
WARNING = l
ERROR = l
FATAL = l
}
Even if you'll make your custom logger with implemented interfaces you'll have a problem, because each level will not differ.
maybe you can use machinery/v1/log/Set(l logging.LoggerInterface)?
// Set sets a custom logger for all log levels func Set(l logging.LoggerInterface) { DEBUG = l INFO = l WARNING = l ERROR = l FATAL = l }
Even if you'll make your custom logger with implemented interfaces you'll have a problem, because each level will not differ.
Actually machinery logger provides methods to set logger for each log level, for me I implement it by wrapping my own loggers like this: