Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To automatically reformat the code before creating a pull request, run:

./gradlew spotlessApply

You can set up a pre-commit (or pre-push) hook following this guide (optional) https://medium.com/@mmessell/apply-spotless-formatting-with-git-pre-commit-hook-1c484ea68c34


pre-push hook example - save as .git/hooks/pre-push in the root of your besu working dir

#!/bin/sh
echo "Running spotlessApply. Formatting code..."
./gradlew spotlessApply --parallel
echo "checking if any files required spotless alterations"
stagedFiles=$(git diff --name-only)

for file in $stagedFiles; do
  if test -f "$file"; then
    echo "!! spotlessApply results need commit - aborting push"
    exit 1 # exit if spotless check failed
  fi
done

Install Google Style Settings

...

  • Trace - Extremely detailed view showing the execution flow. Likely only useful to developers
  • Debug - Information that is diagnostically helpful to a wider group than just developers (for example, sysadmins)
  • Info - Generally useful information to log (for example, service start/stop, configuration assumptions). Default logging level
  • Warn - Anything that can potentially cause application oddities but from which Besu automatically recovers
  • Error - Any error which is fatal to the operation, but not Besu itself (for example, missing data)
  • Fatal - An error that forces a shutdown of Besu

DEBUG Principles

  •  Aimed at both end users and developers
  •  Should lead to resolution of common problems, whilst not spamming
  •  Should not contain logs that take up more than one terminal screen, e.g. raw data, including RLP

DEBUG Guidelines

  • Should not include peer discovery
  • Should not include txpool management
  • Could include some peering to debug peering issues
  • Could include some high level syncing logs
  • Could include API requests, including potentially truncated data, but not full RLP

TRACE Principles

  • Aimed at developers
  • Expectation is everything is there and it's spammy
  • Only useful when targeting certain packages/classes