pub struct BinaryNinjaLayer {
pub target_mappings: Vec<(String, String)>,
pub format_target: bool,
}Expand description
Subscribes to all spans and events emitted by tracing and forwards them to the core logging API.
Fields§
§target_mappings: Vec<(String, String)>Rewrite mappings for the default target.
§Example
Given the target “my_crate::commands::analyze” and the mapping (“my_crate”, “MyPlugin”) the target will be rewritten to “MyPlugin::commands::analyze”, assuming no other rewrites occur.
format_target: boolWhether the default target should be formatted to be displayed in the “common” logger name format for Binary Ninja.
This formatting will only be applied when the target name is implicit. Explicitly provided target names will be preserved as-is.
§Example
Given the target “my_crate::commands::analyze” the target will be rewritten to “MyCrate.Commands.Analyze”.
Implementations§
Source§impl BinaryNinjaLayer
impl BinaryNinjaLayer
pub fn new() -> Self
Sourcepub fn with_target_mapping(self, old: &str, new: &str) -> Self
pub fn with_target_mapping(self, old: &str, new: &str) -> Self
Add a target mapping which will rewrite the old in the default target to new.
This is typically done when you have a plugin name that is verbose, and you wish to display it in the logs as something else.
Sourcepub fn with_format_target(self, formatted: bool) -> Self
pub fn with_format_target(self, formatted: bool) -> Self
Whether formatting of the default target should be applied when sending logs to the core.
Source§impl BinaryNinjaLayer
impl BinaryNinjaLayer
Sourcepub fn rewrite_target(&self, target: String) -> String
pub fn rewrite_target(&self, target: String) -> String
Rewrite the target so that the logger name will be displayed in the common Binary Ninja format.
Trait Implementations§
Source§impl Clone for BinaryNinjaLayer
impl Clone for BinaryNinjaLayer
Source§fn clone(&self) -> BinaryNinjaLayer
fn clone(&self) -> BinaryNinjaLayer
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for BinaryNinjaLayer
impl Default for BinaryNinjaLayer
Source§impl<S> Layer<S> for BinaryNinjaLayerwhere
S: Subscriber + for<'a> LookupSpan<'a>,
impl<S> Layer<S> for BinaryNinjaLayerwhere
S: Subscriber + for<'a> LookupSpan<'a>,
Source§fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
Attributes and Id.Source§fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>)
fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>)
§fn on_register_dispatch(&self, subscriber: &Dispatch)
fn on_register_dispatch(&self, subscriber: &Dispatch)
Subscriber. Read more§fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
Subscriber::register_callsite. Read more§fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool
fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool
true if this layer is interested in a span or event with the
given metadata in the current [Context], similarly to
Subscriber::enabled. Read more§fn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)
fn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)
Id recorded the given
values.§fn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)
fn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)
span recorded that it
follows from the span with the ID follows.§fn event_enabled(&self, _event: &Event<'_>, _ctx: Context<'_, S>) -> bool
fn event_enabled(&self, _event: &Event<'_>, _ctx: Context<'_, S>) -> bool
§fn on_enter(&self, _id: &Id, _ctx: Context<'_, S>)
fn on_enter(&self, _id: &Id, _ctx: Context<'_, S>)
§fn on_exit(&self, _id: &Id, _ctx: Context<'_, S>)
fn on_exit(&self, _id: &Id, _ctx: Context<'_, S>)
§fn on_close(&self, _id: Id, _ctx: Context<'_, S>)
fn on_close(&self, _id: Id, _ctx: Context<'_, S>)
§fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
§fn and_then<L>(self, layer: L) -> Layered<L, Self, S>where
L: Layer<S>,
Self: Sized,
fn and_then<L>(self, layer: L) -> Layered<L, Self, S>where
L: Layer<S>,
Self: Sized,
Layer, returning a Layered
struct implementing Layer. Read more§fn with_subscriber(self, inner: S) -> Layered<Self, S>where
Self: Sized,
fn with_subscriber(self, inner: S) -> Layered<Self, S>where
Self: Sized,
Layer with the given Subscriber, returning a
Layered struct that implements Subscriber. Read more