go-spacemesh icon indicating copy to clipboard operation
go-spacemesh copied to clipboard

Logger improvements

Open moshababo opened this issue 5 years ago • 0 comments

Overview / Motivation

Improve logger functionality and usage throughout the codebase.

The Task

  • All log strings should be unified and formatted properly, including errors concatenation.
  • Errors should be logged only once, in the proper context.
  • Events log string should not be ambiguous regarding whether something was started or finished.
  • Add loglevel support (critical, error, warn, info, debug, verbose, trace) per subsystem, which can be activated via cmd args. Default loglevel should be info.
  • Log JSON format should be disabled by default, and should log the attached fields properly. There should be no dependency between how you log something and a specific display mode of the logger.
  • Log line format should be fixed: If not running in multi-instances test mode, the logger name / nodeId should be omitted. subsystem should be printed before the loglevel.
  • NodeId should not be logged as an extra field.
  • Avoid logging as error/warning events which were triggered by other nodes on the network, but should not concern that running node (for example, a peer requested an object which doesn't exist locally). If this is needed for testing in controlled environment, other solution should be used.
  • Log should support a disabled mode. This is needed mainly for unit testing, when the logger is flooding stdout, making it hard to follow the test results.

moshababo avatar Aug 19 '19 07:08 moshababo