Mercurial > crates > nonstick
diff src/logging.rs @ 118:39760dfc9b3b
Detect PAM library based only on system lib; rename minimal lib to XSso.
Also formats and assorted other cleanup.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Sun, 29 Jun 2025 20:13:03 -0400 |
parents | a12706e42c9d |
children | 98a624cacd82 |
line wrap: on
line diff
--- a/src/logging.rs Sun Jun 29 18:48:14 2025 -0400 +++ b/src/logging.rs Sun Jun 29 20:13:03 2025 -0400 @@ -47,18 +47,23 @@ Debug = levels::DEBUG, } -/// The location of a log entry. +/// The location of a log entry. Use [`location!`](crate::location!) to create this. #[derive(Clone, Copy, Debug, Default)] +#[non_exhaustive] pub struct Location<'a> { pub file: &'a str, pub line: u32, pub function: &'a str, - _more: (), } impl<'a> Location<'a> { + /// Creates a new location. Just use [`location!`](crate::location!) instead. pub fn new(file: &'a str, line: u32, function: &'a str) -> Self { - Self {file, line, function, _more: ()} + Self { + file, + line, + function, + } } } @@ -66,7 +71,9 @@ #[doc(hidden)] #[macro_export] macro_rules! location { - () => { $crate::logging::Location::new(file!(), line!(), $crate::__function!()) } + () => { + $crate::logging::Location::new(file!(), line!(), $crate::__function!()) + }; } /// Here's the guts of the logger thingy. You shouldn't be using this! @@ -90,7 +97,7 @@ ::std::any::type_name::<T>() } f(p).trim_end_matches("::p") - }} + }}; } /// Logs a message at error level via the given PAM handle.