Skip to content

Commit

Permalink
fixup flags
Browse files Browse the repository at this point in the history
Signed-off-by: tison <[email protected]>
  • Loading branch information
tisonkun committed Nov 16, 2024
1 parent 718519c commit c98a454
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion changelog/2537.added.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Add support for `syslog`, `openlog`, `closelog` on `macos`.
Add support for `syslog`, `openlog`, `closelog` on all `unix`.
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ feature! {
pub mod spawn;
}

#[cfg(unix)]
feature! {
#![feature = "syslog"]
pub mod syslog;
Expand Down
7 changes: 6 additions & 1 deletion src/syslog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ where
/// ```rust
/// use nix::syslog::{openlog, syslog, Facility, LogFlags, Severity};
///
/// openlog(None::<&str>, LogFlags::LOG_PID, Facility::LOG_USER).unwrap();
/// #[cfg(not(target_os = "haiku"))]
/// let flags = LogFlags::LOG_PID;
/// #[cfg(target_os = "haiku")]
/// let flags = LogFlags::empty();
///
/// openlog(None::<&str>, flags, Facility::LOG_USER).unwrap();
/// syslog(Severity::LOG_EMERG, "Hello, nix!").unwrap();
///
/// // use `format!` to format the message
Expand Down
1 change: 0 additions & 1 deletion test/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ mod test_sendfile;
))]
mod test_spawn;

#[cfg(unix)]
mod test_syslog;

mod test_time;
Expand Down
7 changes: 6 additions & 1 deletion test/test_syslog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ use nix::syslog::{openlog, syslog, Facility, LogFlags, Severity};

#[test]
fn test_syslog_hello_world() {
openlog(None::<&str>, LogFlags::LOG_PID, Facility::LOG_USER).unwrap();
#[cfg(not(target_os = "haiku"))]
let flags = LogFlags::LOG_PID;
#[cfg(target_os = "haiku")]
let flags = LogFlags::empty();

openlog(None::<&str>, flags, Facility::LOG_USER).unwrap();
syslog(Severity::LOG_EMERG, "Hello, nix!").unwrap();

let name = "syslog";
Expand Down

0 comments on commit c98a454

Please sign in to comment.