diff --git a/Cargo.toml b/Cargo.toml index 56742b6..fbec72b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "oslog" description = "A minimal safe wrapper around Apple's Logging system" repository = "https://github.com/steven-joruk/oslog" -version = "0.2.0" +version = "0.2.1" authors = ["Steven Joruk "] edition = "2021" license = "MIT" diff --git a/src/lib.rs b/src/lib.rs index 6a4ef4d..5014c99 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,6 +39,12 @@ impl From for Level { pub struct OsLog { inner: os_log_t, + /// These need to remain allocated or system logging code can use + /// them after they are freed. + #[allow(dead_code)] + subsystem: Option, + #[allow(dead_code)] + category: Option, } unsafe impl Send for OsLog {} @@ -64,7 +70,11 @@ impl OsLog { assert!(!inner.is_null(), "Unexpected null value from os_log_create"); - Self { inner } + Self { + inner, + subsystem: Some(subsystem), + category: Some(category), + } } #[inline] @@ -73,7 +83,11 @@ impl OsLog { assert!(!inner.is_null(), "Unexpected null value for OS_DEFAULT_LOG"); - Self { inner } + Self { + inner, + subsystem: None, + category: None, + } } #[inline]