Skip to content

Commit

Permalink
Improve error and missing log for backup service
Browse files Browse the repository at this point in the history
  • Loading branch information
lurenpluto committed May 12, 2023
1 parent 5bd5777 commit 1e17b0e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/component/cyfs-backup/src/data/log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ impl BackupLogFile {
AppendCount::new(1024),
ContentLimit::BytesSurpassed(1024 * 1024 * 10),
Compression::None,
#[cfg(unix)] None,
#[cfg(unix)]
None,
);

Self { writer }
Expand Down Expand Up @@ -58,17 +59,19 @@ impl BackupLogManager {
id: &ObjectId,
e: BuckyError,
) {
let t = if id.is_chunk_id() { "chunk" } else { "object" };

let msg = match isolate_id {
Some(isolate_id) => {
let dec_id = dec_id.unwrap();
if self.state_default_isolate == Some(*isolate_id) {
format!("[{}] [{}] {}\n", dec_id, id, e)
format!("[{}] [{}] [{}] {}\n", t, dec_id, id, e)
} else {
format!("[{}] [{}] [{}] {}\n", isolate_id, dec_id, id, e)
format!("[{}] [{}] [{}] [{}] {}\n", t, isolate_id, dec_id, id, e)
}
}
None => {
format!("[{}] {}\n", id, e)
format!("[{}] [{}] {}\n", t, id, e)
}
};

Expand All @@ -81,17 +84,19 @@ impl BackupLogManager {
dec_id: Option<&ObjectId>,
id: &ObjectId,
) {
let t = if id.is_chunk_id() { "chunk" } else { "object" };

let msg = match isolate_id {
Some(isolate_id) => {
let dec_id = dec_id.unwrap();
if self.state_default_isolate == Some(*isolate_id) {
format!("[{}] [{}]\n", dec_id, id,)
format!("[{}] [{}] [{}]\n", t, dec_id, id,)
} else {
format!("[{}] [{}] [{}]\n", isolate_id, dec_id, id)
format!("[{}] [{}] [{}] [{}]\n", t, isolate_id, dec_id, id)
}
}
None => {
format!("[{}]\n", id)
format!("[{}] [{}]\n", t, id)
}
};

Expand Down

0 comments on commit 1e17b0e

Please sign in to comment.