AleoNet / snarkOS

A Decentralized Operating System for ZK Applications
http://snarkos.org
Apache License 2.0
4.07k stars 2.57k forks source link

Clean up verbosity 0 logging messages and display one-line block sync #3328

Open damons opened 1 week ago

damons commented 1 week ago

Motivation

Currently verbosity settings of the client are mixed with info, debug, and trace log levels. When a user starts the node, the mix of messages is confusing and it's not clear if a node is connecting, syncing blocks, and working properly. It's important to give immediate feedback to users that their node is syncing as quickly as possible without distractions. This patch does two important things:

  1. When running with --verbosity 0 it only displays info messages that give meaningful information to the user about: peer connections (initial, drops, and refreshes) and block sync progress.
  2. It removes the extra \n\n's from the block advance and instead only prints: [{BLOCK_NUM}] {BLOCK_HASH} which gives a clear message to the user every time a block is added to the ledger. When run with verbosity 0, the primary information a user sees is blocks being added to the ledger. This gives immediate and clear feedback to the user that their client node is syncing properly and it shows the performance of the node.

Here's an example of --verbosity 0 output using this PR:

Screenshot 2024-06-23 at 8 29 11 PM

Several files where changed from info! to debug! and vice versa. Some debug!s were changed to trace! as some of the modules override the usual log levels which causes trace and debug logs to be produced at verbosity 0.

Test Plan

Compiled and run using --verbosity 0 and the client output matches the above screenshot.