Repository navigation
Conversation
Use path strings, instance/snapshot IDs and error messages for diagnostics. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| /// Set the working directory used by the JSON backend. | ||
| pub fn working_dir(mut self, working_dir: PathBuf) -> Self { | ||
| trace!("'working_dir' set to {:?}", working_dir); | ||
| trace!("'working_dir' set to {}", working_dir.to_string_lossy().as_ref()); |
There was a problem hiding this comment.
to_string_lossy() returns Cow<'_, str>, which doesn’t implement ScoreDebug. Calling as_ref() borrows it as &str, which the logger supports without QM. This adds no allocation or copy
... from my copilot ... let me know if this is "wrong"?
| impl ScoreDebug for JsonBackend { | ||
| fn fmt(&self, f: score_log::fmt::Writer, spec: &score_log::fmt::FormatSpec) -> score_log::fmt::Result { | ||
| score_log::fmt::DebugStruct::new(f, spec, "JsonBackend") | ||
| .field("snapshot_max_count", &self.snapshot_max_count) |
There was a problem hiding this comment.
Add working_dir field with a string cast manually rather than remove it.
| fn fmt(&self, f: score_log::fmt::Writer, spec: &score_log::fmt::FormatSpec) -> score_log::fmt::Result { | ||
| score_log::fmt::DebugStruct::new(f, spec, "JsonBackend") | ||
| .field("snapshot_max_count", &self.snapshot_max_count) | ||
| .finish_non_exhaustive() |
There was a problem hiding this comment.
With working_dir shown it's finish().
| error!("KVS or hash file not found"); | ||
| error!( | ||
| "KVS or hash file not found: instance={}, snapshot={}", | ||
| instance_id.0, old_snapshot_id.0 |
There was a problem hiding this comment.
InstanceId and SnapshotId implement ScoreDebug, so can be used without .0.
Maybe this would be more consistent with existing error logs: "KVS or hash file not found: {}, {}", instance_id, old_snapshot_id.
Or "KVS or hash file not found for instance ID: {}, snapshot ID: {}", instance_id, old_snapshot_id.
There was a problem hiding this comment.
without .0 ✅ ... format I kept since it is consistent with 7 other log messages
| tmp_path, | ||
| e.to_string() | ||
| ); | ||
| error!("Failed to remove stale temporary file, error: {:?}", e.to_string()); |
There was a problem hiding this comment.
Why remove path of tmp file?
There was a problem hiding this comment.
✅ ... initially thought the path is contained in the error but it is not ... so brought back
Retain diagnostic paths without QM-only formatting and log ID types directly. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Documentation preview for this pull request is available at: |
Remove the forced QM logging flag. Use path strings (inline or reused), instance/snapshot IDs where feasible, and error messages instead of QM-only path formatting. Keep manual
ScoreDebugforJsonBackend.Validated: Rust unit tests with default logging, consumer smoke test with
asil_b, and changed-file copyright/format checks.