Mercurial > crates > nonstick
diff src/logging.rs @ 155:ab8020566cd9
Only use real PAM constants for logging within `nonstick/libpam`.
author | Paul Fisher <paul@pfish.zone> |
---|---|
date | Tue, 08 Jul 2025 00:49:38 -0400 |
parents | efbc235f01d3 |
children |
line wrap: on
line diff
--- a/src/logging.rs Tue Jul 08 00:42:09 2025 -0400 +++ b/src/logging.rs Tue Jul 08 00:49:38 2025 -0400 @@ -15,23 +15,6 @@ //! and may even itself implement `log::Log`, but that interface is not exposed //! to the generic PAM user. -#[cfg(pam_impl = "OpenPam")] -mod levels { - use libpam_sys_helpers::constants; - - pub const ERROR: i32 = constants::PAM_LOG_ERROR; - pub const WARN: i32 = constants::PAM_LOG_NOTICE; - pub const INFO: i32 = constants::PAM_LOG_VERBOSE; - pub const DEBUG: i32 = constants::PAM_LOG_DEBUG; -} -#[cfg(not(pam_impl = "OpenPam"))] -mod levels { - pub const ERROR: i32 = libc::LOG_ERR; - pub const WARN: i32 = libc::LOG_WARNING; - pub const INFO: i32 = libc::LOG_INFO; - pub const DEBUG: i32 = libc::LOG_DEBUG; -} - /// An entry to be added to the log. /// /// The levels are in descending order of importance and correspond roughly @@ -40,12 +23,11 @@ /// Their values are ordered monotonically, either increasing or decreasing, /// depending upon the implementation. #[derive(Clone, Copy, Debug, PartialEq, Eq)] -#[repr(i32)] pub enum Level { - Error = levels::ERROR, - Warning = levels::WARN, - Info = levels::INFO, - Debug = levels::DEBUG, + Error, + Warning, + Info, + Debug, } /// The location of a log entry. Use [`location!`](crate::location!) to create this.