Tracing cleanup (#7168)

#7153
#7146
#7147
#7148 -> Thanks to @ackintosh


  This PR does the following:
1. Disable logging to file when using either `--logfile-max-number 0` or `--logfile-max-size 0`. Note that disabling the log file in this way will also disable `discv5` and `libp2p` logging.
1.  `discv5` and `libp2p` logging will be disabled by default unless running `beacon_node` or `boot_node`. This also should fix the VC panic we were seeing.
1. Removes log rotation and compression from `libp2p` and `discv5` logs. It is now limited to 1 file and will rotate based on the value of the `--logfile-max-size` flag. We could potentially add flags specifically to control the size/number of these, however I felt a single log file was sufficient. Perhaps @AgeManning has opinions about this?
1. Removes all dependency logging and references to `dep_log`.
1.  Introduces workspace filtering to file and stdout. This explicitly allows logs from members of the Lighthouse workspace, disallowing all others. It uses a proc macro which pulls the member list from cargo metadata at compile time. This might be over-engineered but my hope is that this list will not require maintenance.
1. Unifies file and stdout JSON format. With slog, the formats were slightly different. @threehrsleep worked to maintain that format difference, to ensure there was no breaking changes. If these format differences are actually problematic we can restore it, however I felt the added complexity wasn't worth it.
1. General code improvements and cleanup.
This commit is contained in:
Mac L
2025-04-01 21:51:09 +11:00
committed by GitHub
parent fb7ec0d151
commit 4839ed620f
14 changed files with 382 additions and 365 deletions

29
Cargo.lock generated
View File

@@ -1187,6 +1187,20 @@ dependencies = [
"thiserror 1.0.69",
]
[[package]]
name = "cargo_metadata"
version = "0.19.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba"
dependencies = [
"camino",
"cargo-platform",
"semver 1.0.26",
"serde",
"serde_json",
"thiserror 2.0.12",
]
[[package]]
name = "cast"
version = "0.3.0"
@@ -1915,7 +1929,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18e4fdb82bd54a12e42fb58a800dcae6b9e13982238ce2296dc3570b92148e1f"
dependencies = [
"data-encoding",
"syn 1.0.109",
"syn 2.0.100",
]
[[package]]
@@ -2853,7 +2867,7 @@ checksum = "ade3e9c97727343984e1ceada4fdab11142d2ee3472d2c67027d56b1251d4f15"
dependencies = [
"arrayvec",
"bytes",
"cargo_metadata",
"cargo_metadata 0.15.4",
"chrono",
"elliptic-curve 0.12.3",
"ethabi 18.0.0",
@@ -4761,7 +4775,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
dependencies = [
"cfg-if",
"windows-targets 0.48.5",
"windows-targets 0.52.6",
]
[[package]]
@@ -5458,6 +5472,7 @@ dependencies = [
"tracing-core",
"tracing-log",
"tracing-subscriber",
"workspace_members",
]
[[package]]
@@ -10152,6 +10167,14 @@ dependencies = [
"bitflags 2.9.0",
]
[[package]]
name = "workspace_members"
version = "0.1.0"
dependencies = [
"cargo_metadata 0.19.2",
"quote",
]
[[package]]
name = "write16"
version = "1.0.0"