ssv
ssv copied to clipboard
Logging Framework
Is your feature request related to a problem? Please describe.
As a node operator, reading the log output from ssv node is not an easy task.
There is now the option to turn on/off network debug logs (#646), and some kind of hierarchy within (network trace and pubsub trace).
There should be easy to configure log level in the package (p2p
, qbft
, beacon
, etc.) and in the component level (qbft:ctrl
, p2p:pubsub
, etc.) in a generic and clear format across the project.
As a developer, you are required to pass around instances of zap.Logger
to all underlaying packages/components.
It should have been more easy to create a single instance in the package and component level.
Describe the solution you'd like
ipfs/go-log seems like a good match for us.
TLDR
- a wrap on top of zap logger
- use namespaces approach to easily tweak sub-systems logging
Defining a logger on a package/component level, avoiding the redundant logger argument we have all over:
var logger = logging.Logger("ssv:p2p:streams")
logger.Debug("..."")
We'll be able to set specific level of our sub-systems:
err = logging.SetLogLevelRegex("ssv:.*", "info")
err = logging.SetLogLevelRegex("ssv:p2p:.*", "debug")
err = logging.SetLogLevelRegex("ssv:qbft:msgq:.*", "debug")
Describe alternatives you've considered
logrus has a different API which might be to disruptive to change to.
Additional context