diff src/logging.rs @ 134:6c1e1bdb4164

Use standard #[cfg] directives rather than custom proc macros. Instead of having to do a bunch of custom parsing and other logic that tools often choke on, this change introduces an easy way to depend upon custom #[cfg]s provided by the libpam-sys crate.
author Paul Fisher <paul@pfish.zone>
date Thu, 03 Jul 2025 11:03:36 -0400
parents 80c07e5ab22f
children efbc235f01d3
line wrap: on
line diff
--- a/src/logging.rs	Wed Jul 02 03:33:09 2025 -0400
+++ b/src/logging.rs	Thu Jul 03 11:03:36 2025 -0400
@@ -15,16 +15,14 @@
 //! and may even itself implement `log::Log`, but that interface is not exposed
 //! to the generic PAM user.
 
-use libpam_sys::cfg_pam_impl;
-
-#[cfg_pam_impl("OpenPam")]
+#[cfg(pam_impl = "OpenPam")]
 mod levels {
     pub const ERROR: i32 = libpam_sys::PAM_LOG_ERROR;
     pub const WARN: i32 = libpam_sys::PAM_LOG_NOTICE;
     pub const INFO: i32 = libpam_sys::PAM_LOG_VERBOSE;
     pub const DEBUG: i32 = libpam_sys::PAM_LOG_DEBUG;
 }
-#[cfg_pam_impl(not("OpenPam"))]
+#[cfg(not(pam_impl = "OpenPam"))]
 mod levels {
     pub const ERROR: i32 = libc::LOG_ERR;
     pub const WARN: i32 = libc::LOG_WARNING;
@@ -170,7 +168,7 @@
 /// # let userinfo_url = "https://zombo.com/";
 /// nonstick::debug!(pam_handle, "making HTTP GET request to {userinfo_url}");
 /// // Will log a message like
-/// // making HTTP GET request to https://zombo.com/"
+/// //     "making HTTP GET request to https://zombo.com/"
 /// // at DEBUG level on syslog.
 /// # }
 /// ```