summaryrefslogtreecommitdiff
path: root/rust/examples
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/examples
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/examples')
-rw-r--r--rust/examples/dwarf/dwarf_export/src/lib.rs2
-rw-r--r--rust/examples/dwarf/dwarf_import/src/lib.rs2
-rw-r--r--rust/examples/idb_import/src/lib.rs2
-rw-r--r--rust/examples/minidump/src/lib.rs2
-rw-r--r--rust/examples/pdb-ng/src/lib.rs2
-rw-r--r--rust/examples/test_demangler/src/lib.rs2
-rw-r--r--rust/examples/workflow/src/lib.rs3
7 files changed, 7 insertions, 8 deletions
diff --git a/rust/examples/dwarf/dwarf_export/src/lib.rs b/rust/examples/dwarf/dwarf_export/src/lib.rs
index 057abe27..05592f5f 100644
--- a/rust/examples/dwarf/dwarf_export/src/lib.rs
+++ b/rust/examples/dwarf/dwarf_export/src/lib.rs
@@ -781,7 +781,7 @@ impl Command for MyCommand {
#[no_mangle]
pub extern "C" fn CorePluginInit() -> bool {
- init(LevelFilter::Debug).expect("Unable to initialize logger");
+ init(LevelFilter::Debug);
register(
"Export as DWARF",
diff --git a/rust/examples/dwarf/dwarf_import/src/lib.rs b/rust/examples/dwarf/dwarf_import/src/lib.rs
index b04c04db..20076d0c 100644
--- a/rust/examples/dwarf/dwarf_import/src/lib.rs
+++ b/rust/examples/dwarf/dwarf_import/src/lib.rs
@@ -658,7 +658,7 @@ impl CustomDebugInfoParser for DWARFParser {
#[no_mangle]
pub extern "C" fn CorePluginInit() -> bool {
- logger::init(LevelFilter::Debug).unwrap();
+ logger::init(LevelFilter::Debug);
let settings = Settings::new("");
diff --git a/rust/examples/idb_import/src/lib.rs b/rust/examples/idb_import/src/lib.rs
index 4bd75c79..0de688be 100644
--- a/rust/examples/idb_import/src/lib.rs
+++ b/rust/examples/idb_import/src/lib.rs
@@ -337,7 +337,7 @@ fn parse_id0_section_info(
#[allow(non_snake_case)]
#[no_mangle]
pub extern "C" fn CorePluginInit() -> bool {
- let _logger = logger::init(LevelFilter::Error);
+ logger::init(LevelFilter::Error);
DebugInfoParser::register("IDB Parser", IDBDebugInfoParser);
DebugInfoParser::register("TIL Parser", TILDebugInfoParser);
true
diff --git a/rust/examples/minidump/src/lib.rs b/rust/examples/minidump/src/lib.rs
index 9d8b4054..c899591b 100644
--- a/rust/examples/minidump/src/lib.rs
+++ b/rust/examples/minidump/src/lib.rs
@@ -21,7 +21,7 @@ impl Command for PrintMemoryInformationCommand {
#[no_mangle]
#[allow(non_snake_case)]
pub extern "C" fn CorePluginInit() -> bool {
- binaryninja::logger::init(LevelFilter::Trace).expect("failed to initialize logging");
+ binaryninja::logger::init(LevelFilter::Trace);
debug!("Registering minidump binary view type");
register_view_type("Minidump", "Minidump", view::MinidumpBinaryViewType::new);
diff --git a/rust/examples/pdb-ng/src/lib.rs b/rust/examples/pdb-ng/src/lib.rs
index e6a97be5..bc12caae 100644
--- a/rust/examples/pdb-ng/src/lib.rs
+++ b/rust/examples/pdb-ng/src/lib.rs
@@ -697,7 +697,7 @@ pub extern "C" fn PDBPluginInit() -> bool {
}
fn init_plugin() -> bool {
- let _ = logger::init(LevelFilter::Debug);
+ logger::init(LevelFilter::Debug);
DebugInfoParser::register("PDB", PDBParser {});
let settings = Settings::new("");
diff --git a/rust/examples/test_demangler/src/lib.rs b/rust/examples/test_demangler/src/lib.rs
index eaa38dad..6735d5fb 100644
--- a/rust/examples/test_demangler/src/lib.rs
+++ b/rust/examples/test_demangler/src/lib.rs
@@ -57,7 +57,7 @@ impl Command for DemangleCommand {
#[no_mangle]
pub extern "C" fn CorePluginInit() -> bool {
- let _ = logger::init(LevelFilter::Info);
+ logger::init(LevelFilter::Info);
Demangler::register("Test", TestDemangler {});
command::register("Demangle Test", "Test", DemangleCommand {});
true
diff --git a/rust/examples/workflow/src/lib.rs b/rust/examples/workflow/src/lib.rs
index 3e295c51..47a8d2c8 100644
--- a/rust/examples/workflow/src/lib.rs
+++ b/rust/examples/workflow/src/lib.rs
@@ -5,7 +5,6 @@ use binaryninja::workflow::{Activity, AnalysisContext, Workflow};
use log::LevelFilter;
const RUST_ACTIVITY_NAME: &'static str = "analysis.plugins.rustexample";
-// TODO: runOnce needs to be on...
const RUST_ACTIVITY_CONFIG: &'static str = r#"{
"name": "analysis.plugins.rustexample",
"title" : "Rust Example",
@@ -56,7 +55,7 @@ fn example_activity(analysis_context: &AnalysisContext) {
#[no_mangle]
#[allow(non_snake_case)]
pub extern "C" fn CorePluginInit() -> bool {
- binaryninja::logger::init(LevelFilter::Debug).unwrap();
+ binaryninja::logger::init(LevelFilter::Info);
log::info!("Initialized the plugin");