pub struct Settings {
pub title: &'static str,
pub filters: &'static [(&'static str, LevelFilter)],
pub file_out: Option<&'static Path>,
pub console_out: bool,
pub panic_hook: Option<fn(Panic<'_>)>,
}Expand description
Settings for the logger
Fields§
§title: &'static strA human-readable name for the application
filters: &'static [(&'static str, LevelFilter)]List of module-prefix filters to match against, earlier filters get priority
file_out: Option<&'static Path>Optional file path to output to (desktop only)
console_out: boolSet to true to output to an appropriate console
panic_hook: Option<fn(Panic<'_>)>Enables the formatted panic hook, and calls the supplied function.
Use |_| () if you don’t have anything to run
Implementations§
Source§impl Settings
impl Settings
Sourcepub fn init(self)
pub fn init(self)
Examples found in repository?
examples/demo.rs (line 22)
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}Auto Trait Implementations§
impl Freeze for Settings
impl RefUnwindSafe for Settings
impl Send for Settings
impl Sync for Settings
impl Unpin for Settings
impl UnsafeUnpin for Settings
impl UnwindSafe for Settings
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
Mutably borrows from an owned value. Read more