pub struct Logger { /* private fields */ }Expand description
Builder for an opinionated tracing subscriber.
By default the subscriber writes INFO level events to stdout and does
not write to a file. Each log line is prefixed with the elapsed wall-clock
time since the subscriber was initialized, formatted as HHh MMm SSs. This
column can be restarted at any time with Logger::reset_time.
Implementations§
Source§impl Logger
impl Logger
Sourcepub fn stdout(self, enable: bool) -> Self
pub fn stdout(self, enable: bool) -> Self
Enable or disable the stdout layer. Enabled by default.
Sourcepub fn file<P: AsRef<Path>>(self, path: P) -> Self
pub fn file<P: AsRef<Path>>(self, path: P) -> Self
Write logs to the given file path. Parent directories are created as needed and the file is truncated on open.
Sourcepub fn directives(self, directives: impl Into<String>) -> Self
pub fn directives(self, directives: impl Into<String>) -> Self
Override the additional EnvFilter directives appended after the level.
Defaults to "diffsol=off". Pass an empty string to disable the
default directives entirely. The RUST_LOG environment variable, if
set, takes precedence over the configured level and directives.
Sourcepub fn init(self) -> Result<()>
pub fn init(self) -> Result<()>
Install the configured subscriber as the global default.
Returns an error if a log file is configured but cannot be opened. Silently does nothing if a global subscriber is already installed, which makes the subscriber safe to reuse across back-to-back runs.
Sourcepub fn reset_time()
pub fn reset_time()
Restart the elapsed-time column so subsequent log lines count from now.
The leading HHh MMm SSs column is process-wide and shared by every
layer of the installed subscriber. Calling this resets that column to
00h 00m 00s, which is useful before a fresh run when a single
subscriber is reused across back-to-back fits.
This is an associated function rather than a method because the column
lives in process-wide subscriber state, not on a Logger instance
(which is consumed by Logger::init).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Logger
impl RefUnwindSafe for Logger
impl Send for Logger
impl Sync for Logger
impl Unpin for Logger
impl UnsafeUnpin for Logger
impl UnwindSafe for Logger
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Context for T
impl<T> Context for T
fn vector_from_element<V>(&self, len: usize, value: <V as VectorCommon>::T) -> Vwhere
V: Vector<C = Self>,
fn vector_from_vec<V>(&self, vec: Vec<<V as VectorCommon>::T>) -> Vwhere
V: Vector<C = Self>,
fn vector_zeros<V>(&self, len: usize) -> Vwhere
V: Vector<C = Self>,
fn dense_mat_zeros<V>(
&self,
rows: usize,
cols: usize,
) -> <V as DefaultDenseMatrix>::Mwhere
V: Vector<C = Self> + DefaultDenseMatrix,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.