8000 log crate · sha0coder/libscemu@b4e6e06 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Commit b4e6e06

Browse files
committed
log crate
1 parent 03a587c commit b4e6e06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1934
-1933
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ scan_fmt = "0.2.6"
2323
atty = "0.2.14"
2424
csv = "1.3.0"
2525
chrono = { version = "0.4", features = ["serde"] }
26+
log = "0.4.22"

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ while emu.step() {
6161
}
6262

6363
// check result
64-
println!("return value: 0x{:x}", emu.regs.get_eax());
64+
log::info!("return value: 0x{:x}", emu.regs.get_eax());
6565
emu.maps.dump(param2_out_buff);
6666
```
6767

@@ -77,28 +77,28 @@ use iced_x86::{Instruction};
7777

7878
fn trace_memory_read(emu:&mut libscemu::emu::Emu, ip_addr:u64,
7979
mem_addr:u64, sz:u8) {
80-
println!("0x{:x}: reading {} at 0x{:x}", ip_addr, sz, mem_addr);
80+
log::info!("0x{:x}: reading {} at 0x{:x}", ip_addr, sz, mem_addr);
8181
if mem_addr == 0x22dff0 {
8282
emu.stop();
8383
}
8484
}
8585

8686
fn trace_memory_write(emu:&mut libscemu::emu::Emu, ip_addr:u64,
8787
mem_addr:u64, sz:u8, value:u128) -> u128 {
88-
println!("0x{:x}: writing {} '0x{:x}' at 0x{:x}", ip_addr, sz,
88+
log::info!("0x{:x}: writing {} '0x{:x}' at 0x{:x}", ip_addr, sz,
8989
value, mem_addr);
9090
value // I could change the value to write
9191
}
9292

9393
fn trace_interrupt(emu:&mut libscemu::emu::Emu, ip_addr:u64,
9494
interrupt:u64) -> bool {
95-
println!("interrupt {} triggered at eip: 0x{:x}", interrupt,
95+
log::info!("interrupt {} triggered at eip: 0x{:x}", interrupt,
9696
ip_addr);
9797
true // do handle interrupts
9898
}
9999

100100
fn trace_exceptions(emu:&mut libscemu::emu::Emu, ip_addr:u64) -> bool {
101-
println!("0x{:x} triggered an exception", ip_addr);
101+
log::info!("0x{:x} triggered an exception", ip_addr);
102102
true // do handle exceptions
103103
}
104104

@@ -128,6 +128,6 @@ fn main() {
128128
emu.hook.on_post_instruction(trace_post_instruction);
129129
emu.hook.on_winapi_call(trace_winapi_call);
130130
emu.run(None).unwrap();
131-
println!("end!");
131+
log::info!("end!");
132132
}
133133
```

0 commit comments

Comments
 (0)
0