1#![allow(unused_imports)]
5#![allow(deprecated)]
6#![allow(non_snake_case)]
7#![allow(non_camel_case_types)]
8#![allow(non_upper_case_globals)]
9#![allow(missing_docs)]
10#![allow(clippy::too_many_arguments)]
11#![allow(clippy::type_complexity)]
12#![allow(clippy::upper_case_acronyms)]
13#![allow(clippy::identity_op)]
14#![allow(clippy::missing_safety_doc)]
15#![allow(clippy::doc_lazy_continuation)]
16#![allow(rustdoc::broken_intra_doc_links)]
17#![allow(rustdoc::bare_urls)]
18#![allow(rustdoc::invalid_html_tags)]
19
20#[link(name = "OSLog", kind = "framework")]
21extern "C" {}
22
23use core::ffi::*;
24use core::ptr::NonNull;
25use objc2::__framework_prelude::*;
26use objc2_foundation::*;
27
28use crate::*;
29
30#[repr(transparent)]
70#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
71pub struct OSLogEntryStoreCategory(pub NSInteger);
72impl OSLogEntryStoreCategory {
73 #[doc(alias = "OSLogEntryStoreCategoryUndefined")]
74 pub const Undefined: Self = Self(0);
75 #[doc(alias = "OSLogEntryStoreCategoryMetadata")]
76 pub const Metadata: Self = Self(1);
77 #[doc(alias = "OSLogEntryStoreCategoryShortTerm")]
78 pub const ShortTerm: Self = Self(2);
79 #[doc(alias = "OSLogEntryStoreCategoryLongTermAuto")]
80 pub const LongTermAuto: Self = Self(3);
81 #[doc(alias = "OSLogEntryStoreCategoryLongTerm1")]
82 pub const LongTerm1: Self = Self(4);
83 #[doc(alias = "OSLogEntryStoreCategoryLongTerm3")]
84 pub const LongTerm3: Self = Self(5);
85 #[doc(alias = "OSLogEntryStoreCategoryLongTerm7")]
86 pub const LongTerm7: Self = Self(6);
87 #[doc(alias = "OSLogEntryStoreCategoryLongTerm14")]
88 pub const LongTerm14: Self = Self(7);
89 #[doc(alias = "OSLogEntryStoreCategoryLongTerm30")]
90 pub const LongTerm30: Self = Self(8);
91}
92
93unsafe impl Encode for OSLogEntryStoreCategory {
94 const ENCODING: Encoding = NSInteger::ENCODING;
95}
96
97unsafe impl RefEncode for OSLogEntryStoreCategory {
98 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
99}
100
101extern_class!(
102 #[unsafe(super(NSObject))]
106 #[derive(Debug, PartialEq, Eq, Hash)]
107 pub struct OSLogEntry;
108);
109
110extern_conformance!(
111 unsafe impl NSObjectProtocol for OSLogEntry {}
112);
113
114impl OSLogEntry {
115 extern_methods!(
116 #[unsafe(method(composedMessage))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn composedMessage(&self) -> Retained<NSString>;
120
121 #[unsafe(method(date))]
123 #[unsafe(method_family = none)]
124 pub unsafe fn date(&self) -> Retained<NSDate>;
125
126 #[unsafe(method(storeCategory))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn storeCategory(&self) -> OSLogEntryStoreCategory;
130 );
131}
132
133impl OSLogEntry {
135 extern_methods!(
136 #[unsafe(method(init))]
137 #[unsafe(method_family = init)]
138 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
139
140 #[unsafe(method(new))]
141 #[unsafe(method_family = new)]
142 pub unsafe fn new() -> Retained<Self>;
143 );
144}
145
146extern_protocol!(
147 pub unsafe trait OSLogEntryFromProcess {
153 #[unsafe(method(activityIdentifier))]
155 #[unsafe(method_family = none)]
156 unsafe fn activityIdentifier(&self) -> os_activity_id_t;
157
158 #[unsafe(method(process))]
160 #[unsafe(method_family = none)]
161 unsafe fn process(&self) -> Retained<NSString>;
162
163 #[cfg(feature = "libc")]
164 #[unsafe(method(processIdentifier))]
166 #[unsafe(method_family = none)]
167 unsafe fn processIdentifier(&self) -> libc::pid_t;
168
169 #[unsafe(method(sender))]
171 #[unsafe(method_family = none)]
172 unsafe fn sender(&self) -> Retained<NSString>;
173
174 #[unsafe(method(threadIdentifier))]
176 #[unsafe(method_family = none)]
177 unsafe fn threadIdentifier(&self) -> u64;
178 }
179);
180
181extern_protocol!(
182 pub unsafe trait OSLogEntryWithPayload {
187 #[unsafe(method(category))]
189 #[unsafe(method_family = none)]
190 unsafe fn category(&self) -> Retained<NSString>;
191
192 #[unsafe(method(components))]
194 #[unsafe(method_family = none)]
195 unsafe fn components(&self) -> Retained<NSArray<OSLogMessageComponent>>;
196
197 #[unsafe(method(formatString))]
199 #[unsafe(method_family = none)]
200 unsafe fn formatString(&self) -> Retained<NSString>;
201
202 #[unsafe(method(subsystem))]
204 #[unsafe(method_family = none)]
205 unsafe fn subsystem(&self) -> Retained<NSString>;
206 }
207);
208
209impl OSLogEntry {
210 extern_methods!();
211}
212
213extern_conformance!(
214 unsafe impl NSSecureCoding for OSLogEntry {}
215);
216
217extern_class!(
218 #[unsafe(super(OSLogEntry, NSObject))]
222 #[derive(Debug, PartialEq, Eq, Hash)]
223 pub struct OSLogEntryActivity;
224);
225
226extern_conformance!(
227 unsafe impl NSObjectProtocol for OSLogEntryActivity {}
228);
229
230extern_conformance!(
231 unsafe impl OSLogEntryFromProcess for OSLogEntryActivity {}
232);
233
234impl OSLogEntryActivity {
235 extern_methods!(
236 #[unsafe(method(parentActivityIdentifier))]
238 #[unsafe(method_family = none)]
239 pub unsafe fn parentActivityIdentifier(&self) -> os_activity_id_t;
240 );
241}
242
243impl OSLogEntryActivity {
245 extern_methods!(
246 #[unsafe(method(init))]
247 #[unsafe(method_family = init)]
248 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
249
250 #[unsafe(method(new))]
251 #[unsafe(method_family = new)]
252 pub unsafe fn new() -> Retained<Self>;
253 );
254}
255
256extern_class!(
257 #[unsafe(super(OSLogEntry, NSObject))]
267 #[derive(Debug, PartialEq, Eq, Hash)]
268 pub struct OSLogEntryBoundary;
269);
270
271extern_conformance!(
272 unsafe impl NSObjectProtocol for OSLogEntryBoundary {}
273);
274
275impl OSLogEntryBoundary {
276 extern_methods!();
277}
278
279impl OSLogEntryBoundary {
281 extern_methods!(
282 #[unsafe(method(init))]
283 #[unsafe(method_family = init)]
284 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
285
286 #[unsafe(method(new))]
287 #[unsafe(method_family = new)]
288 pub unsafe fn new() -> Retained<Self>;
289 );
290}
291
292#[repr(transparent)]
297#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
298pub struct OSLogEntryLogLevel(pub NSInteger);
299impl OSLogEntryLogLevel {
300 #[doc(alias = "OSLogEntryLogLevelUndefined")]
301 pub const Undefined: Self = Self(0);
302 #[doc(alias = "OSLogEntryLogLevelDebug")]
303 pub const Debug: Self = Self(1);
304 #[doc(alias = "OSLogEntryLogLevelInfo")]
305 pub const Info: Self = Self(2);
306 #[doc(alias = "OSLogEntryLogLevelNotice")]
307 pub const Notice: Self = Self(3);
308 #[doc(alias = "OSLogEntryLogLevelError")]
309 pub const Error: Self = Self(4);
310 #[doc(alias = "OSLogEntryLogLevelFault")]
311 pub const Fault: Self = Self(5);
312}
313
314unsafe impl Encode for OSLogEntryLogLevel {
315 const ENCODING: Encoding = NSInteger::ENCODING;
316}
317
318unsafe impl RefEncode for OSLogEntryLogLevel {
319 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
320}
321
322extern_class!(
323 #[unsafe(super(OSLogEntry, NSObject))]
327 #[derive(Debug, PartialEq, Eq, Hash)]
328 pub struct OSLogEntryLog;
329);
330
331extern_conformance!(
332 unsafe impl NSObjectProtocol for OSLogEntryLog {}
333);
334
335extern_conformance!(
336 unsafe impl OSLogEntryFromProcess for OSLogEntryLog {}
337);
338
339extern_conformance!(
340 unsafe impl OSLogEntryWithPayload for OSLogEntryLog {}
341);
342
343impl OSLogEntryLog {
344 extern_methods!(
345 #[unsafe(method(level))]
347 #[unsafe(method_family = none)]
348 pub unsafe fn level(&self) -> OSLogEntryLogLevel;
349 );
350}
351
352impl OSLogEntryLog {
354 extern_methods!(
355 #[unsafe(method(init))]
356 #[unsafe(method_family = init)]
357 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
358
359 #[unsafe(method(new))]
360 #[unsafe(method_family = new)]
361 pub unsafe fn new() -> Retained<Self>;
362 );
363}
364
365#[repr(transparent)]
370#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
371pub struct OSLogEntrySignpostType(pub NSInteger);
372impl OSLogEntrySignpostType {
373 #[doc(alias = "OSLogEntrySignpostTypeUndefined")]
374 pub const Undefined: Self = Self(0);
375 #[doc(alias = "OSLogEntrySignpostTypeIntervalBegin")]
376 pub const IntervalBegin: Self = Self(1);
377 #[doc(alias = "OSLogEntrySignpostTypeIntervalEnd")]
378 pub const IntervalEnd: Self = Self(2);
379 #[doc(alias = "OSLogEntrySignpostTypeEvent")]
380 pub const Event: Self = Self(3);
381}
382
383unsafe impl Encode for OSLogEntrySignpostType {
384 const ENCODING: Encoding = NSInteger::ENCODING;
385}
386
387unsafe impl RefEncode for OSLogEntrySignpostType {
388 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
389}
390
391extern_class!(
392 #[unsafe(super(OSLogEntry, NSObject))]
396 #[derive(Debug, PartialEq, Eq, Hash)]
397 pub struct OSLogEntrySignpost;
398);
399
400extern_conformance!(
401 unsafe impl NSObjectProtocol for OSLogEntrySignpost {}
402);
403
404extern_conformance!(
405 unsafe impl OSLogEntryFromProcess for OSLogEntrySignpost {}
406);
407
408extern_conformance!(
409 unsafe impl OSLogEntryWithPayload for OSLogEntrySignpost {}
410);
411
412impl OSLogEntrySignpost {
413 extern_methods!(
414 #[unsafe(method(signpostIdentifier))]
416 #[unsafe(method_family = none)]
417 pub unsafe fn signpostIdentifier(&self) -> os_signpost_id_t;
418
419 #[unsafe(method(signpostName))]
421 #[unsafe(method_family = none)]
422 pub unsafe fn signpostName(&self) -> Retained<NSString>;
423
424 #[unsafe(method(signpostType))]
426 #[unsafe(method_family = none)]
427 pub unsafe fn signpostType(&self) -> OSLogEntrySignpostType;
428 );
429}
430
431impl OSLogEntrySignpost {
433 extern_methods!(
434 #[unsafe(method(init))]
435 #[unsafe(method_family = init)]
436 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
437
438 #[unsafe(method(new))]
439 #[unsafe(method_family = new)]
440 pub unsafe fn new() -> Retained<Self>;
441 );
442}
443
444#[repr(transparent)]
453#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
454pub struct OSLogEnumeratorOptions(pub NSUInteger);
455bitflags::bitflags! {
456 impl OSLogEnumeratorOptions: NSUInteger {
457 #[doc(alias = "OSLogEnumeratorReverse")]
458 const Reverse = 0x01;
459 }
460}
461
462unsafe impl Encode for OSLogEnumeratorOptions {
463 const ENCODING: Encoding = NSUInteger::ENCODING;
464}
465
466unsafe impl RefEncode for OSLogEnumeratorOptions {
467 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
468}
469
470extern_class!(
471 #[unsafe(super(NSEnumerator, NSObject))]
475 #[derive(Debug, PartialEq, Eq, Hash)]
476 pub struct OSLogEnumerator;
477);
478
479extern_conformance!(
480 unsafe impl NSFastEnumeration for OSLogEnumerator {}
481);
482
483extern_conformance!(
484 unsafe impl NSObjectProtocol for OSLogEnumerator {}
485);
486
487impl OSLogEnumerator {
488 extern_methods!();
489}
490
491impl OSLogEnumerator {
493 extern_methods!(
494 #[unsafe(method(init))]
495 #[unsafe(method_family = init)]
496 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
497
498 #[unsafe(method(new))]
499 #[unsafe(method_family = new)]
500 pub unsafe fn new() -> Retained<Self>;
501 );
502}
503
504#[repr(transparent)]
512#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
513pub struct OSLogMessageComponentArgumentCategory(pub NSInteger);
514impl OSLogMessageComponentArgumentCategory {
515 #[doc(alias = "OSLogMessageComponentArgumentCategoryUndefined")]
516 pub const Undefined: Self = Self(0);
517 #[doc(alias = "OSLogMessageComponentArgumentCategoryData")]
518 pub const Data: Self = Self(1);
519 #[doc(alias = "OSLogMessageComponentArgumentCategoryDouble")]
520 pub const Double: Self = Self(2);
521 #[doc(alias = "OSLogMessageComponentArgumentCategoryInt64")]
522 pub const Int64: Self = Self(3);
523 #[doc(alias = "OSLogMessageComponentArgumentCategoryString")]
524 pub const String: Self = Self(4);
525 #[doc(alias = "OSLogMessageComponentArgumentCategoryUInt64")]
526 pub const UInt64: Self = Self(5);
527}
528
529unsafe impl Encode for OSLogMessageComponentArgumentCategory {
530 const ENCODING: Encoding = NSInteger::ENCODING;
531}
532
533unsafe impl RefEncode for OSLogMessageComponentArgumentCategory {
534 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
535}
536
537extern_class!(
538 #[unsafe(super(NSObject))]
544 #[derive(Debug, PartialEq, Eq, Hash)]
545 pub struct OSLogMessageComponent;
546);
547
548extern_conformance!(
549 unsafe impl NSCoding for OSLogMessageComponent {}
550);
551
552extern_conformance!(
553 unsafe impl NSObjectProtocol for OSLogMessageComponent {}
554);
555
556extern_conformance!(
557 unsafe impl NSSecureCoding for OSLogMessageComponent {}
558);
559
560impl OSLogMessageComponent {
561 extern_methods!(
562 #[unsafe(method(formatSubstring))]
566 #[unsafe(method_family = none)]
567 pub unsafe fn formatSubstring(&self) -> Retained<NSString>;
568
569 #[unsafe(method(placeholder))]
571 #[unsafe(method_family = none)]
572 pub unsafe fn placeholder(&self) -> Retained<NSString>;
573
574 #[unsafe(method(argumentCategory))]
577 #[unsafe(method_family = none)]
578 pub unsafe fn argumentCategory(&self) -> OSLogMessageComponentArgumentCategory;
579
580 #[unsafe(method(argumentDataValue))]
584 #[unsafe(method_family = none)]
585 pub unsafe fn argumentDataValue(&self) -> Option<Retained<NSData>>;
586
587 #[unsafe(method(argumentDoubleValue))]
591 #[unsafe(method_family = none)]
592 pub unsafe fn argumentDoubleValue(&self) -> c_double;
593
594 #[unsafe(method(argumentInt64Value))]
597 #[unsafe(method_family = none)]
598 pub unsafe fn argumentInt64Value(&self) -> i64;
599
600 #[unsafe(method(argumentNumberValue))]
604 #[unsafe(method_family = none)]
605 pub unsafe fn argumentNumberValue(&self) -> Option<Retained<NSNumber>>;
606
607 #[unsafe(method(argumentStringValue))]
611 #[unsafe(method_family = none)]
612 pub unsafe fn argumentStringValue(&self) -> Option<Retained<NSString>>;
613
614 #[unsafe(method(argumentUInt64Value))]
618 #[unsafe(method_family = none)]
619 pub unsafe fn argumentUInt64Value(&self) -> u64;
620 );
621}
622
623impl OSLogMessageComponent {
625 extern_methods!(
626 #[unsafe(method(init))]
627 #[unsafe(method_family = init)]
628 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
629
630 #[unsafe(method(new))]
631 #[unsafe(method_family = new)]
632 pub unsafe fn new() -> Retained<Self>;
633 );
634}
635
636extern_class!(
637 #[unsafe(super(NSObject))]
646 #[derive(Debug, PartialEq, Eq, Hash)]
647 pub struct OSLogPosition;
648);
649
650extern_conformance!(
651 unsafe impl NSObjectProtocol for OSLogPosition {}
652);
653
654impl OSLogPosition {
655 extern_methods!(
656 #[unsafe(method(init))]
657 #[unsafe(method_family = init)]
658 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
659 );
660}
661
662impl OSLogPosition {
664 extern_methods!(
665 #[unsafe(method(new))]
666 #[unsafe(method_family = new)]
667 pub unsafe fn new() -> Retained<Self>;
668 );
669}
670
671#[repr(transparent)]
681#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
682pub struct OSLogStoreScope(pub NSInteger);
683impl OSLogStoreScope {
684 #[doc(alias = "OSLogStoreSystem")]
685 pub const System: Self = Self(0);
686 #[doc(alias = "OSLogStoreCurrentProcessIdentifier")]
687 pub const CurrentProcessIdentifier: Self = Self(1);
688}
689
690unsafe impl Encode for OSLogStoreScope {
691 const ENCODING: Encoding = NSInteger::ENCODING;
692}
693
694unsafe impl RefEncode for OSLogStoreScope {
695 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
696}
697
698extern_class!(
699 #[unsafe(super(NSObject))]
710 #[derive(Debug, PartialEq, Eq, Hash)]
711 pub struct OSLogStore;
712);
713
714extern_conformance!(
715 unsafe impl NSObjectProtocol for OSLogStore {}
716);
717
718impl OSLogStore {
719 extern_methods!(
720 #[unsafe(method(localStoreAndReturnError:_))]
735 #[unsafe(method_family = none)]
736 pub unsafe fn localStoreAndReturnError() -> Result<Retained<Self>, Retained<NSError>>;
737
738 #[unsafe(method(storeWithScope:error:_))]
747 #[unsafe(method_family = none)]
748 pub unsafe fn storeWithScope_error(
749 scope: OSLogStoreScope,
750 ) -> Result<Retained<Self>, Retained<NSError>>;
751
752 #[unsafe(method(storeWithURL:error:_))]
763 #[unsafe(method_family = none)]
764 pub unsafe fn storeWithURL_error(url: &NSURL) -> Result<Retained<Self>, Retained<NSError>>;
765
766 #[deprecated = "Use one of the factory methods"]
767 #[unsafe(method(init))]
768 #[unsafe(method_family = init)]
769 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
770
771 #[unsafe(method(entriesEnumeratorWithOptions:position:predicate:error:_))]
793 #[unsafe(method_family = none)]
794 pub unsafe fn entriesEnumeratorWithOptions_position_predicate_error(
795 &self,
796 options: OSLogEnumeratorOptions,
797 position: Option<&OSLogPosition>,
798 predicate: Option<&NSPredicate>,
799 ) -> Result<Retained<OSLogEnumerator>, Retained<NSError>>;
800
801 #[unsafe(method(entriesEnumeratorAndReturnError:_))]
808 #[unsafe(method_family = none)]
809 pub unsafe fn entriesEnumeratorAndReturnError(
810 &self,
811 ) -> Result<Retained<OSLogEnumerator>, Retained<NSError>>;
812
813 #[unsafe(method(positionWithDate:))]
823 #[unsafe(method_family = none)]
824 pub unsafe fn positionWithDate(&self, date: &NSDate) -> Retained<OSLogPosition>;
825
826 #[unsafe(method(positionWithTimeIntervalSinceEnd:))]
832 #[unsafe(method_family = none)]
833 pub unsafe fn positionWithTimeIntervalSinceEnd(
834 &self,
835 seconds: NSTimeInterval,
836 ) -> Retained<OSLogPosition>;
837
838 #[unsafe(method(positionWithTimeIntervalSinceLatestBoot:))]
848 #[unsafe(method_family = none)]
849 pub unsafe fn positionWithTimeIntervalSinceLatestBoot(
850 &self,
851 seconds: NSTimeInterval,
852 ) -> Retained<OSLogPosition>;
853 );
854}
855
856impl OSLogStore {
858 extern_methods!(
859 #[unsafe(method(new))]
860 #[unsafe(method_family = new)]
861 pub unsafe fn new() -> Retained<Self>;
862 );
863}