Struct Backtrace

Source
pub struct Backtrace { /* private fields */ }
Expand description

System-agnostic backtrace type

Implementations§

Source§

impl Backtrace

Source

pub fn write<W: Write>(&self, writer: W) -> Result<()>

Print backtrace to a writer

§Errors

if the writer errors, or backtrace error

Source

pub fn as_string(&self) -> String

Get the backtrace as a string

Examples found in repository?
examples/demo.rs (line 18)
8fn main() {
9	multiline_logger::Settings {
10		title: "logger test",
11		filters: &[("", LevelFilter::Trace)],
12		file_out: Some(Path::new("target/test.log")),
13		console_out: true,
14		#[expect(clippy::print_stdout, reason = "demo")]
15		panic_hook: Some(|info| {
16			println!(
17				"Custom panic handler\nPanic info: {info:?}\nBacktrace: {:?}",
18				info.trace.as_string()
19			);
20		}),
21	}
22	.init();
23	log::trace!("Trace\n");
24	log::debug!("Debug\n{:?}", [1, 2, 3, 4]);
25	log::info!("Info: {}", 7);
26	log::warn!("Warn {:#?}", [0, 9, 8, 7]);
27	log::error!("Error");
28	panic!("Panic Message");
29}

Trait Implementations§

Source§

impl Debug for Backtrace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.