diff options
author | Ben Bridle <ben@derelict.engineering> | 2025-01-12 10:52:59 +1300 |
---|---|---|
committer | Ben Bridle <ben@derelict.engineering> | 2025-01-12 10:52:59 +1300 |
commit | 8bfc20d44d3a0d040c6f7031f4975afd515e7424 (patch) | |
tree | 8c32aa0be4af33b4041b2084e1322aceec3d0c49 /src/debug.rs | |
parent | bd9b53d9cf976539ed977e0535325ee12091543c (diff) | |
download | bedrock-pc-8bfc20d44d3a0d040c6f7031f4975afd515e7424.zip |
Only print halt messages if the verbose flag is set
This required passing the verbose flag state down into the DebugState
structure.
Diffstat (limited to 'src/debug.rs')
-rw-r--r-- | src/debug.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/debug.rs b/src/debug.rs index c01ee15..6270948 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -13,15 +13,17 @@ const BLUE: &str = "\x1b[34m"; pub struct DebugState { pub enabled: bool, + pub verbose: bool, last_cycle: usize, last_mark: Instant, symbols: DebugSymbols, } impl DebugState { - pub fn new<P: AsRef<Path>>(enabled: bool, symbols_path: Option<P>) -> Self { + pub fn new<P: AsRef<Path>>(enabled: bool, verbose: bool, symbols_path: Option<P>) -> Self { Self { enabled, + verbose, last_cycle: 0, last_mark: Instant::now(), symbols: DebugSymbols::from_path_opt(symbols_path), @@ -29,7 +31,7 @@ impl DebugState { } pub fn info(&self, string: &str) { - if self.enabled { + if self.verbose { eprintln!("{BOLD}{BLUE}[INFO]{NORMAL}: {string}{NORMAL}"); } } |