Mercurial > crates > nonstick
comparison src/logging.rs @ 174:9e4ce1631bd3
Dramatically expand documentation.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Tue, 29 Jul 2025 18:58:27 -0400 |
| parents | e27c5c667a5a |
| children | 5e4ea9650f87 |
comparison
equal
deleted
inserted
replaced
| 173:46e8ce5cd5d1 | 174:9e4ce1631bd3 |
|---|---|
| 32 /// | 32 /// |
| 33 /// # Example | 33 /// # Example |
| 34 /// | 34 /// |
| 35 /// ```no_run | 35 /// ```no_run |
| 36 /// # use nonstick::PamShared; | 36 /// # use nonstick::PamShared; |
| 37 /// use nonstick::location; | |
| 37 /// use nonstick::logging::Level; | 38 /// use nonstick::logging::Level; |
| 38 /// use nonstick::location; | |
| 39 /// # fn _test(pam_hdl: impl PamShared) { | 39 /// # fn _test(pam_hdl: impl PamShared) { |
| 40 /// # let delay_ms = 100; | 40 /// # let delay_ms = 100; |
| 41 /// # let url = "https://zombo.com"; | 41 /// # let url = "https://zombo.com"; |
| 42 /// // Usually, instead of calling this manually, just use the macros. | 42 /// // Usually, instead of calling this manually, just use the macros. |
| 43 /// nonstick::error!(pam_hdl, "something bad happened!"); | 43 /// nonstick::error!(pam_hdl, "something bad happened!"); |
| 44 /// nonstick::warn!(pam_hdl, "loading information took {delay_ms} ms"); | 44 /// nonstick::warn!(pam_hdl, "loading information took {delay_ms} ms"); |
| 45 /// nonstick::info!(pam_hdl, "using network backend"); | 45 /// nonstick::info!(pam_hdl, "using network backend"); |
| 46 /// nonstick::debug!(pam_hdl, "sending GET request to {url}"); | 46 /// nonstick::debug!(pam_hdl, "sending GET request to {url}"); |
| 47 /// // But if you really want to, you can call this yourself: | 47 /// // But if you really want to, you can call this yourself: |
| 48 /// pam_hdl.log(Level::Warn, location!(), format_args!("this is unnecessarily verbose")); | 48 /// pam_hdl.log( |
| 49 /// Level::Warn, | |
| 50 /// location!(), | |
| 51 /// format_args!("this is unnecessarily verbose"), | |
| 52 /// ); | |
| 49 /// # } | 53 /// # } |
| 50 /// ``` | 54 /// ``` |
| 51 #[doc = man7!(3 pam_syslog)] | 55 #[doc = man7!(3 pam_syslog)] |
| 52 #[doc = manbsd!(3 openpam_log)] | 56 #[doc = manbsd!(3 openpam_log)] |
| 53 fn log(&self, level: Level, loc: Location<'_>, entry: fmt::Arguments); | 57 fn log(&self, level: Level, loc: Location<'_>, entry: fmt::Arguments); |
