pub struct ScriptLogHandle { /* private fields */ }Expand description
Handle for accessing and managing script logs captured during execution.
This structure provides a thread-safe interface for storing and retrieving
log entries generated by Rhai scripts. It implements the tracing Layer trait
to automatically capture relevant log events.
Implementations§
Source§impl ScriptLogHandle
impl ScriptLogHandle
Sourcepub fn new(max_script_log_message_length: usize, max_log_entries: usize) -> Self
pub fn new(max_script_log_message_length: usize, max_log_entries: usize) -> Self
Creates a new ScriptLogHandle with specified message length and max log entries limits
Sourcepub fn get_logs(&self) -> Vec<LogEntry>
pub fn get_logs(&self) -> Vec<LogEntry>
Retrieves all captured script log entries.
This method returns a clone of all log entries that have been captured since the handle was created or last cleared. The returned vector contains entries in the order they were captured.
§Returns
A Vec<LogEntry> containing all captured log entries. Returns an empty
vector if no logs have been captured or if there was an error accessing
the internal log storage.
Sourcepub fn was_max_limit_applied(&self) -> bool
pub fn was_max_limit_applied(&self) -> bool
Returns whether the maximum limit was applied and elements were removed.
This method checks if the bounded deque ever reached capacity and had to evict older entries to make room for new ones.
§Returns
true if the limit was applied at least once, false otherwise.
Trait Implementations§
Source§impl Clone for ScriptLogHandle
impl Clone for ScriptLogHandle
Source§fn clone(&self) -> ScriptLogHandle
fn clone(&self) -> ScriptLogHandle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ScriptLogHandle
impl Debug for ScriptLogHandle
Source§impl Default for ScriptLogHandle
impl Default for ScriptLogHandle
Source§impl<S> Layer<S> for ScriptLogHandlewhere
S: Subscriber + for<'lookup> LookupSpan<'lookup>,
Implementation of the tracing Layer trait for ScriptLogHandle.
impl<S> Layer<S> for ScriptLogHandlewhere
S: Subscriber + for<'lookup> LookupSpan<'lookup>,
Implementation of the tracing Layer trait for ScriptLogHandle.
This implementation allows the script log handle to be used as a tracing layer, automatically capturing events that match the script log target and converting them into structured log entries.
Source§fn on_event(&self, event: &Event<'_>, _ctx: Context<'_, S>)
fn on_event(&self, event: &Event<'_>, _ctx: Context<'_, S>)
Processes tracing events and captures those matching the script log target.
Source§fn on_register_dispatch(&self, subscriber: &Dispatch)
fn on_register_dispatch(&self, subscriber: &Dispatch)
Subscriber. Read moreSource§fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
Subscriber::register_callsite. Read moreSource§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 moreSource§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_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.Source§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.Source§fn on_enter(&self, _id: &Id, _ctx: Context<'_, S>)
fn on_enter(&self, _id: &Id, _ctx: Context<'_, S>)
Source§fn on_exit(&self, _id: &Id, _ctx: Context<'_, S>)
fn on_exit(&self, _id: &Id, _ctx: Context<'_, S>)
Source§fn on_close(&self, _id: Id, _ctx: Context<'_, S>)
fn on_close(&self, _id: Id, _ctx: Context<'_, S>)
Source§fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
Source§fn and_then<L>(self, layer: L) -> Layered<L, Self, S>
fn and_then<L>(self, layer: L) -> Layered<L, Self, S>
Layer, returning a Layered
struct implementing Layer. Read moreSource§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