diff options
author | kyoheiu <kyoheiu@outlook.com> | 2022-05-21 06:03:59 +0900 |
---|---|---|
committer | kyoheiu <kyoheiu@outlook.com> | 2022-05-21 06:03:59 +0900 |
commit | 020073188559973787de5b213a5d380a9c32cf87 (patch) | |
tree | d55e89832833d7f8af5a11b066a5b38211bb4434 /src/op.rs | |
parent | c0d97fe951b445e07893dd56d1b0f30ae2f9b7aa (diff) |
Implement logging of undo/redo
Diffstat (limited to 'src/op.rs')
-rw-r--r-- | src/op.rs | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -76,10 +76,30 @@ fn log(op: &OpKind) { info!("{}", result); } +pub fn relog(op: &OpKind, undo: bool) { + let mut result = if undo { + "UNDO: ".to_string() + } else { + "REDO: ".to_string() + }; + match op { + OpKind::Put(_) => { + result.push_str("PUT"); + } + OpKind::Delete(_) => { + result.push_str("DELETE"); + } + OpKind::Rename(_) => { + result.push_str("RENAME"); + } + } + info!("{}", result); +} + fn item_to_string(v: &Vec<ItemInfo>) -> String { let mut result = String::new(); for p in v { - result.push_str(&p.file_name); + result.push_str(p.file_path.as_path().to_str().unwrap()); result.push(' '); } result |