Mercurial > crates > nonstick
comparison src/logging.rs @ 113:178310336596
Fix up more constants, make things i32 rather than u32.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Sun, 29 Jun 2025 03:11:33 -0400 |
| parents | e97534be35e3 |
| children | 1e11a52b4665 |
comparison
equal
deleted
inserted
replaced
| 112:82995b4dccee | 113:178310336596 |
|---|---|
| 16 //! to the generic PAM user. | 16 //! to the generic PAM user. |
| 17 | 17 |
| 18 #[cfg(all(feature = "link", pam_impl = "openpam"))] | 18 #[cfg(all(feature = "link", pam_impl = "openpam"))] |
| 19 mod levels { | 19 mod levels { |
| 20 use crate::libpam::pam_ffi; | 20 use crate::libpam::pam_ffi; |
| 21 pub const ERROR: u32 = pam_ffi::PAM_LOG_ERROR; | 21 pub const ERROR: i32 = pam_ffi::PAM_LOG_ERROR; |
| 22 pub const WARN: u32 = pam_ffi::PAM_LOG_NOTICE; | 22 pub const WARN: i32 = pam_ffi::PAM_LOG_NOTICE; |
| 23 pub const INFO: u32 = pam_ffi::PAM_LOG_VERBOSE; | 23 pub const INFO: i32 = pam_ffi::PAM_LOG_VERBOSE; |
| 24 pub const DEBUG: u32 = pam_ffi::PAM_LOG_DEBUG; | 24 pub const DEBUG: i32 = pam_ffi::PAM_LOG_DEBUG; |
| 25 } | 25 } |
| 26 #[cfg(not(all(feature = "link", pam_impl = "openpam")))] | 26 #[cfg(not(all(feature = "link", pam_impl = "openpam")))] |
| 27 mod levels { | 27 mod levels { |
| 28 pub const ERROR: u32 = libc::LOG_ERR as u32; | 28 pub const ERROR: i32 = libc::LOG_ERR; |
| 29 pub const WARN: u32 = libc::LOG_WARNING as u32; | 29 pub const WARN: i32 = libc::LOG_WARNING; |
| 30 pub const INFO: u32 = libc::LOG_INFO as u32; | 30 pub const INFO: i32 = libc::LOG_INFO; |
| 31 pub const DEBUG: u32 = libc::LOG_DEBUG as u32; | 31 pub const DEBUG: i32 = libc::LOG_DEBUG; |
| 32 } | 32 } |
| 33 | 33 |
| 34 /// An entry to be added to the log. | 34 /// An entry to be added to the log. |
| 35 /// | 35 /// |
| 36 /// The levels are in descending order of importance and correspond roughly | 36 /// The levels are in descending order of importance and correspond roughly |
| 37 /// to the similarly-named levels in the `log` crate. | 37 /// to the similarly-named levels in the `log` crate. |
| 38 /// | 38 /// |
| 39 /// In all implementations, these are ordered such that `Error`, `Warning`, | 39 /// In all implementations, these are ordered such that `Error`, `Warning`, |
| 40 /// `Info`, and `Debug` are in ascending order. | 40 /// `Info`, and `Debug` are in ascending order. |
| 41 #[derive(Debug, PartialEq, Ord, PartialOrd, Eq)] | 41 #[derive(Debug, PartialEq, Ord, PartialOrd, Eq)] |
| 42 #[repr(u32)] | 42 #[repr(i32)] |
| 43 pub enum Level { | 43 pub enum Level { |
| 44 Error = levels::ERROR, | 44 Error = levels::ERROR, |
| 45 Warning = levels::WARN, | 45 Warning = levels::WARN, |
| 46 Info = levels::INFO, | 46 Info = levels::INFO, |
| 47 Debug = levels::DEBUG, | 47 Debug = levels::DEBUG, |
