Mercurial > crates > nonstick
comparison src/logging.rs @ 130:80c07e5ab22f
Transfer over (almost) completely to using libpam-sys.
This reimplements everything in nonstick on top of the new -sys crate.
We don't yet use libpam-sys's helpers for binary message payloads. Soon.
| author | Paul Fisher <paul@pfish.zone> |
|---|---|
| date | Tue, 01 Jul 2025 06:11:43 -0400 |
| parents | 98a624cacd82 |
| children | 6c1e1bdb4164 |
comparison
equal
deleted
inserted
replaced
| 129:5b2de52dd8b2 | 130:80c07e5ab22f |
|---|---|
| 13 //! | 13 //! |
| 14 //! A `PamShared` implementation may still use the `log` crate on the backend, | 14 //! A `PamShared` implementation may still use the `log` crate on the backend, |
| 15 //! and may even itself implement `log::Log`, but that interface is not exposed | 15 //! and may even itself implement `log::Log`, but that interface is not exposed |
| 16 //! to the generic PAM user. | 16 //! to the generic PAM user. |
| 17 | 17 |
| 18 #[cfg(all(feature = "link", pam_impl = "openpam"))] | 18 use libpam_sys::cfg_pam_impl; |
| 19 | |
| 20 #[cfg_pam_impl("OpenPam")] | |
| 19 mod levels { | 21 mod levels { |
| 20 use crate::libpam::pam_ffi; | 22 pub const ERROR: i32 = libpam_sys::PAM_LOG_ERROR; |
| 21 pub const ERROR: i32 = pam_ffi::PAM_LOG_ERROR; | 23 pub const WARN: i32 = libpam_sys::PAM_LOG_NOTICE; |
| 22 pub const WARN: i32 = pam_ffi::PAM_LOG_NOTICE; | 24 pub const INFO: i32 = libpam_sys::PAM_LOG_VERBOSE; |
| 23 pub const INFO: i32 = pam_ffi::PAM_LOG_VERBOSE; | 25 pub const DEBUG: i32 = libpam_sys::PAM_LOG_DEBUG; |
| 24 pub const DEBUG: i32 = pam_ffi::PAM_LOG_DEBUG; | 26 } |
| 25 } | 27 #[cfg_pam_impl(not("OpenPam"))] |
| 26 #[cfg(not(all(feature = "link", pam_impl = "openpam")))] | |
| 27 mod levels { | 28 mod levels { |
| 28 pub const ERROR: i32 = libc::LOG_ERR; | 29 pub const ERROR: i32 = libc::LOG_ERR; |
| 29 pub const WARN: i32 = libc::LOG_WARNING; | 30 pub const WARN: i32 = libc::LOG_WARNING; |
| 30 pub const INFO: i32 = libc::LOG_INFO; | 31 pub const INFO: i32 = libc::LOG_INFO; |
| 31 pub const DEBUG: i32 = libc::LOG_DEBUG; | 32 pub const DEBUG: i32 = libc::LOG_DEBUG; |
