diff options
| author | KyleMiles <krm504@nyu.edu> | 2023-01-30 22:50:58 -0500 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2023-01-30 22:50:58 -0500 |
| commit | de663e595b6c47653e4a953473ed42eba5ffcb97 (patch) | |
| tree | 21165e07ee47b394e63254282fde295e980b2264 /rust | |
| parent | 895b186c0273146ac915d855214e98e07f54de65 (diff) | |
Rust API : Slight docs improvements
Diffstat (limited to 'rust')
| -rw-r--r-- | rust/src/command.rs | 8 | ||||
| -rw-r--r-- | rust/src/logger.rs | 34 |
2 files changed, 35 insertions, 7 deletions
diff --git a/rust/src/command.rs b/rust/src/command.rs index 977aad4c..1d5eb622 100644 --- a/rust/src/command.rs +++ b/rust/src/command.rs @@ -63,7 +63,7 @@ where /// /// # Example /// ```rust -/// Struct MyCommand; +/// struct MyCommand; /// /// impl Command for MyCommand { /// fn action(&self, view: &BinaryView) { @@ -161,7 +161,7 @@ where /// /// # Example /// ```rust -/// Struct MyCommand; +/// struct MyCommand; /// /// impl AddressCommand for MyCommand { /// fn action(&self, view: &BinaryView, addr: u64) { @@ -259,7 +259,7 @@ where /// /// # Example /// ```rust -/// Struct MyCommand; +/// struct MyCommand; /// /// impl AddressCommand for MyCommand { /// fn action(&self, view: &BinaryView, range: Range<u64>) { @@ -362,7 +362,7 @@ where /// /// # Example /// ```rust -/// Struct MyCommand; +/// struct MyCommand; /// /// impl AddressCommand for MyCommand { /// fn action(&self, view: &BinaryView, func: &Function) { diff --git a/rust/src/logger.rs b/rust/src/logger.rs index 2b067892..eab0c647 100644 --- a/rust/src/logger.rs +++ b/rust/src/logger.rs @@ -1,12 +1,40 @@ -use std::os::raw::{c_char, c_void}; - -use log; +//! To use logging in your script, do something like: +//! +//! ``` +//! use binaryninja::logger; +//! use log::{info, LevelFilter}; +//! +//! fn main() { +//! logger::init(LevelFilter::Warn).expect("Unable to initialize logger"); +//! info!("The logger has been initialized!"); +//! // Your code here... +//! } +//! ``` +//! +//! or +//! +//!``` +//! use binaryninja::logger; +//! use log::{info, LevelFilter}; +//! +//! #[no_mangle] +//! pub extern "C" fn CorePluginInit() -> bool { +//! logger::init(LevelFilter::Warn).expect("Unable to initialize logger"); +//! info!("The logger has been initialized!"); +//! // Your code here... +//! true +//! } +//! ``` +//! use crate::string::BnStr; pub use binaryninjacore_sys::BNLogLevel as Level; use binaryninjacore_sys::{BNLogListener, BNUpdateLogListeners}; +use log; +use std::os::raw::{c_char, c_void}; + struct Logger; static LOGGER: Logger = Logger; |
