Closed danbryan closed 1 year ago
The client code is already using the same logger for all of the logs it generates.
That said, the client uses gin a go-based web framework to handle most of the actual work, and this has its own logger.
Looking at the docs, it looks like we can tweak how gin does its log formatting, but I don't think we can get it to do the pretty printing.
Here are what I considered to be the best options:
@danbryan @KyleMoser What do you think?
@davidkonigsberg Doesn't it uses both gin and the standard log package. Do these these log events get processed via gin?
https://github.com/DefiantLabs/cosmos-tax-cli-private/blob/main/client/client.go#L26 https://github.com/DefiantLabs/cosmos-tax-cli-private/blob/main/client/client.go#L29 https://github.com/DefiantLabs/cosmos-tax-cli-private/blob/main/client/client.go#L32 ... https://github.com/DefiantLabs/cosmos-tax-cli-private/blob/main/client/client.go#L80
All of those logs are from before the zero logger gets configured. We don't have zero logger until we inject the zerologger stuff from the config.
It may be possible to use the logger before it is configured, but we will just get the default behavior for those logs until the logger does get configured lower down in the code.
Btw, I think the above solution is a good compromise and should be easy/trivial to implement, just wanted to get on the same page for it before I do it.
I have updated the logs to use an unconfigured zero logger if it fails before startup. Gonna also try to get Gin to format its logs like zero logger...
ohh, I might actually be able to inject our logger into gin using their middleware functionality!
switch this to zero log, allow for pretty print