Repository navigation
refactor(log): route all logs through the tracing crate - #71
Merged
Merged
Conversation
Per-watch log files (~/.fleet/logs/{id}.log) are preserved: a custom
tracing Layer (src/log/file_layer.rs) appends every event carrying a
log_path field, keeping the historical '[ts] LEVEL: message' format
(ANSI badges honor FLEET_NO_COLOR). Logger becomes a facade emitting
tracing events; production call sites now emit tracing macros directly
and the logger plumbing was dropped from the exec signatures.
init_tracing() is now always on and idempotent (OnceLock + try_init):
a registry with the file layer plus an RUST_LOG-filtered stderr layer
(default WARN). The debug-logs cargo feature is removed and
tracing-subscriber is a regular dependency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remplac~- contrôle des logs par la crate
tracingtout en préservant les fichiers par watch.Avant
Loggerécrit directement dans~/.fleet/logs/{id}.logvia unArc<Mutex<File>>, chaque call site passe un&Loggeren paramètre (exec_timeout,exec_background,contain_cmd/immergé dansensure_image,runner).paint_level) est dupliqué, le console warning deparser.rsécrit sur stdout.Après
file_layer.rs(traittracing::Layer): chaque event portant un champlog_pathest appendé au fichier de la watch, dans le format historique[ts] LEVEL: messageavec badges ANSI (INFO/WARNING/ERROR/JOB START/END),FLEET_NO_COLORrespecté.Loggerdevient une façade:info/warning/error/job_start/job_endémettent des eventstracingportantlog_path; l'API fichier (new/fetchn/path_by_id/clean/...) est conservée (TUIfleet stats+ tests inchangés).logger: &Loggerest supprimé decommand.rs/container.rs/runner.rs; les call sites prod utilisenttracing::info!/warn!/error!aveclog_path = %ctx.log_path().display().init_tracing()est toujours actif et idempotent (OnceLock+try_init): registry = file layer + stderr filtré parRUST_LOG(défaut WARN, ANSI respecteFLEET_NO_COLOR).debug-logssupprimée,tracing-subscribernon-optionnel.ExecMetrics.logger(mort), doublonBackground command launched,use anyhow::Ok.Vérification
cargo fmt --check,cargo clippy --all-targets --all-features -- -D warnings,cargo test --features no-tty(45 tests, --test-threads=1),cargo build --release: tout est vert.