Lazy logging function that prints like 20MB of messages
(&self, msg: F)
| 455 | |
| 456 | /// Lazy logging function that prints like 20MB of messages |
| 457 | pub(crate) fn log<F: FnOnce() -> D, D: Display>(&self, msg: F) { |
| 458 | static MEM: OnceLock<bool> = OnceLock::new(); |
| 459 | let debug_pdb = MEM.get_or_init(|| env::var("BN_DEBUG_PDB").is_ok()); |
| 460 | if *debug_pdb { |
| 461 | let space = "\t".repeat(self.type_stack.len()) + &"\t".repeat(self.symbol_stack.len()); |
| 462 | let msg = format!("{}", msg()); |
| 463 | debug!( |
| 464 | "{}{}", |
| 465 | space, |
| 466 | msg.replace("\n", &("\n".to_string() + &space)) |
| 467 | ); |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | pub(crate) fn split_progress<'b, F: Fn(usize, usize) -> Result<()> + 'b>( |
| 472 | original_fn: F, |
no test coverage detected