summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-10-19 20:53:10 -0400
committerMason Reed <mason@vector35.com>2024-11-04 19:43:26 -0500
commit62f2dd7c6c89ca44f2096f535962b63f26f57730 (patch)
tree01e2eb165809fc2a653680281a6879f8e6f02d65 /rust/src
parent8609cc98bad6926d7ca94f10112b315d5d820ee0 (diff)
Remove ability to panic on pre-initialized logger in rust
Typically this would never occur, however due to the mystical nature of linkers this somehow has happened outside of demo builds
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/logger.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/rust/src/logger.rs b/rust/src/logger.rs
index 6e0b1887..4e9dd1f9 100644
--- a/rust/src/logger.rs
+++ b/rust/src/logger.rs
@@ -75,11 +75,13 @@ impl log::Log for Logger {
fn flush(&self) {}
}
-/// Uses BinaryNinja's logging functionality as the sink for
-/// Rust's `log` crate.
-pub fn init(filter: log::LevelFilter) -> Result<(), log::SetLoggerError> {
+/// Uses BinaryNinja's logging functionality as the sink for Rust's `log` crate.
+///
+/// NOTE: There is no guarantee that logs will be sent to BinaryNinja as another log sink
+/// may have already been initialized beforehand.
+pub fn init(filter: log::LevelFilter) {
log::set_max_level(filter);
- log::set_logger(&LOGGER)
+ let _ = log::set_logger(&LOGGER);
}
pub trait LogListener: 'static + Sync {