objc2-os-log 0.3.2

Bindings to the OSLog framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
// This file has been automatically generated by `objc2`'s `header-translator`.
// DO NOT EDIT

#![allow(unused_imports)]
#![allow(deprecated)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
#![allow(missing_docs)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::type_complexity)]
#![allow(clippy::upper_case_acronyms)]
#![allow(clippy::identity_op)]
#![allow(clippy::missing_safety_doc)]
#![allow(clippy::doc_lazy_continuation)]
#![allow(rustdoc::broken_intra_doc_links)]
#![allow(rustdoc::bare_urls)]
#![allow(rustdoc::invalid_html_tags)]

#[link(name = "OSLog", kind = "framework")]
extern "C" {}

use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// A classification of how the entry was to be stored and
/// rotated at the point when it was created.
///
///
/// The unified logging system keeps entries in one of two
/// places: a ring buffer in memory and a persisted data store.
/// Entries are rotated out of both places to free up resources.
/// This rotation is not strictly aligned with entries'
/// timestamps --- in particular, they can be rotated in bulk,
/// and they are rotated according to a series of heuristics that
/// take into account space, time, and how the entries were
/// classified.
///
///
/// This entry was generated as information about the other
/// entries or about the sequence of entries as a whole.
///
///
/// This entry was not intended to be long-lived and was captured
/// in the ring buffer.
///
///
/// The entry was intended to be persisted in a filesystem-backed
/// data store and kept mainly based on the amount of space
/// available.
///
///
///
///
///
///
/// The entry was tagged with a hint indicating that the system
/// should try to preserve it for a certain amount of time. It
/// was persisted in the filesystem-backed data store, and
/// rotation of these entries was based on both time and space
/// considerations.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogentrystorecategory?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct OSLogEntryStoreCategory(pub NSInteger);
impl OSLogEntryStoreCategory {
    #[doc(alias = "OSLogEntryStoreCategoryUndefined")]
    pub const Undefined: Self = Self(0);
    #[doc(alias = "OSLogEntryStoreCategoryMetadata")]
    pub const Metadata: Self = Self(1);
    #[doc(alias = "OSLogEntryStoreCategoryShortTerm")]
    pub const ShortTerm: Self = Self(2);
    #[doc(alias = "OSLogEntryStoreCategoryLongTermAuto")]
    pub const LongTermAuto: Self = Self(3);
    #[doc(alias = "OSLogEntryStoreCategoryLongTerm1")]
    pub const LongTerm1: Self = Self(4);
    #[doc(alias = "OSLogEntryStoreCategoryLongTerm3")]
    pub const LongTerm3: Self = Self(5);
    #[doc(alias = "OSLogEntryStoreCategoryLongTerm7")]
    pub const LongTerm7: Self = Self(6);
    #[doc(alias = "OSLogEntryStoreCategoryLongTerm14")]
    pub const LongTerm14: Self = Self(7);
    #[doc(alias = "OSLogEntryStoreCategoryLongTerm30")]
    pub const LongTerm30: Self = Self(8);
}

unsafe impl Encode for OSLogEntryStoreCategory {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for OSLogEntryStoreCategory {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// A single entry from the unified logging system.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogentry?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct OSLogEntry;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for OSLogEntry {}
);

impl OSLogEntry {
    extern_methods!(
        /// The fully formatted message for the entry.
        #[unsafe(method(composedMessage))]
        #[unsafe(method_family = none)]
        pub unsafe fn composedMessage(&self) -> Retained<NSString>;

        /// The timestamp of the entry.
        #[unsafe(method(date))]
        #[unsafe(method_family = none)]
        pub unsafe fn date(&self) -> Retained<NSDate>;

        /// This entry's storage tag. See OSLogEntryStoreCategory.
        #[unsafe(method(storeCategory))]
        #[unsafe(method_family = none)]
        pub unsafe fn storeCategory(&self) -> OSLogEntryStoreCategory;
    );
}

/// Methods declared on superclass `NSObject`.
impl OSLogEntry {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_protocol!(
    /// Entry subclasses conforming to this protocol represent data
    /// that are generated from a process; they have metadata about
    /// the originator.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogentryfromprocess?language=objc)
    pub unsafe trait OSLogEntryFromProcess {
        /// The activity ID associated with the entry.
        #[unsafe(method(activityIdentifier))]
        #[unsafe(method_family = none)]
        unsafe fn activityIdentifier(&self) -> os_activity_id_t;

        /// The name of the process that made the entry.
        #[unsafe(method(process))]
        #[unsafe(method_family = none)]
        unsafe fn process(&self) -> Retained<NSString>;

        #[cfg(feature = "libc")]
        /// The pid of the process that made the entry.
        #[unsafe(method(processIdentifier))]
        #[unsafe(method_family = none)]
        unsafe fn processIdentifier(&self) -> libc::pid_t;

        /// The name of the binary image that made the entry.
        #[unsafe(method(sender))]
        #[unsafe(method_family = none)]
        unsafe fn sender(&self) -> Retained<NSString>;

        /// The tid of the thread that made the entry.
        #[unsafe(method(threadIdentifier))]
        #[unsafe(method_family = none)]
        unsafe fn threadIdentifier(&self) -> u64;
    }
);

extern_protocol!(
    /// Entry subclasses conforming to this protocol represent
    /// entries that were made using a handle and a format string.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogentrywithpayload?language=objc)
    pub unsafe trait OSLogEntryWithPayload {
        /// The category from the os_log_t handle used.
        #[unsafe(method(category))]
        #[unsafe(method_family = none)]
        unsafe fn category(&self) -> Retained<NSString>;

        /// An array of the various parts of the composed message.
        #[unsafe(method(components))]
        #[unsafe(method_family = none)]
        unsafe fn components(&self) -> Retained<NSArray<OSLogMessageComponent>>;

        /// The format string used.
        #[unsafe(method(formatString))]
        #[unsafe(method_family = none)]
        unsafe fn formatString(&self) -> Retained<NSString>;

        /// The subsystem of the os_log_t handle used.
        #[unsafe(method(subsystem))]
        #[unsafe(method_family = none)]
        unsafe fn subsystem(&self) -> Retained<NSString>;
    }
);

impl OSLogEntry {
    extern_methods!();
}

extern_conformance!(
    unsafe impl NSSecureCoding for OSLogEntry {}
);

extern_class!(
    /// An entry generated by an activity event.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogentryactivity?language=objc)
    #[unsafe(super(OSLogEntry, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct OSLogEntryActivity;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for OSLogEntryActivity {}
);

extern_conformance!(
    unsafe impl OSLogEntryFromProcess for OSLogEntryActivity {}
);

impl OSLogEntryActivity {
    extern_methods!(
        /// This parent activity's activity ID.
        #[unsafe(method(parentActivityIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn parentActivityIdentifier(&self) -> os_activity_id_t;
    );
}

/// Methods declared on superclass `NSObject`.
impl OSLogEntryActivity {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// This entry represents metadata that partitions sequences of
    /// other entries.
    ///
    ///
    /// For example, this kind of entry is used for boot boundaries.
    /// The data here are currently informational and carried in the
    /// composedMessage property.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogentryboundary?language=objc)
    #[unsafe(super(OSLogEntry, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct OSLogEntryBoundary;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for OSLogEntryBoundary {}
);

impl OSLogEntryBoundary {
    extern_methods!();
}

/// Methods declared on superclass `NSObject`.
impl OSLogEntryBoundary {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// The level that this entry was generated at.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogentryloglevel?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct OSLogEntryLogLevel(pub NSInteger);
impl OSLogEntryLogLevel {
    #[doc(alias = "OSLogEntryLogLevelUndefined")]
    pub const Undefined: Self = Self(0);
    #[doc(alias = "OSLogEntryLogLevelDebug")]
    pub const Debug: Self = Self(1);
    #[doc(alias = "OSLogEntryLogLevelInfo")]
    pub const Info: Self = Self(2);
    #[doc(alias = "OSLogEntryLogLevelNotice")]
    pub const Notice: Self = Self(3);
    #[doc(alias = "OSLogEntryLogLevelError")]
    pub const Error: Self = Self(4);
    #[doc(alias = "OSLogEntryLogLevelFault")]
    pub const Fault: Self = Self(5);
}

unsafe impl Encode for OSLogEntryLogLevel {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for OSLogEntryLogLevel {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// Entries made by the os_log API.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogentrylog?language=objc)
    #[unsafe(super(OSLogEntry, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct OSLogEntryLog;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for OSLogEntryLog {}
);

extern_conformance!(
    unsafe impl OSLogEntryFromProcess for OSLogEntryLog {}
);

extern_conformance!(
    unsafe impl OSLogEntryWithPayload for OSLogEntryLog {}
);

impl OSLogEntryLog {
    extern_methods!(
        /// The level of the entry, e.g., info, debug.
        #[unsafe(method(level))]
        #[unsafe(method_family = none)]
        pub unsafe fn level(&self) -> OSLogEntryLogLevel;
    );
}

/// Methods declared on superclass `NSObject`.
impl OSLogEntryLog {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// The kind of of signpost emitted.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogentrysignposttype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct OSLogEntrySignpostType(pub NSInteger);
impl OSLogEntrySignpostType {
    #[doc(alias = "OSLogEntrySignpostTypeUndefined")]
    pub const Undefined: Self = Self(0);
    #[doc(alias = "OSLogEntrySignpostTypeIntervalBegin")]
    pub const IntervalBegin: Self = Self(1);
    #[doc(alias = "OSLogEntrySignpostTypeIntervalEnd")]
    pub const IntervalEnd: Self = Self(2);
    #[doc(alias = "OSLogEntrySignpostTypeEvent")]
    pub const Event: Self = Self(3);
}

unsafe impl Encode for OSLogEntrySignpostType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for OSLogEntrySignpostType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// Entries made by the os_signpost API.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogentrysignpost?language=objc)
    #[unsafe(super(OSLogEntry, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct OSLogEntrySignpost;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for OSLogEntrySignpost {}
);

extern_conformance!(
    unsafe impl OSLogEntryFromProcess for OSLogEntrySignpost {}
);

extern_conformance!(
    unsafe impl OSLogEntryWithPayload for OSLogEntrySignpost {}
);

impl OSLogEntrySignpost {
    extern_methods!(
        /// The signpost ID associated with this entry.
        #[unsafe(method(signpostIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn signpostIdentifier(&self) -> os_signpost_id_t;

        /// The signpost name associated with this entry.
        #[unsafe(method(signpostName))]
        #[unsafe(method_family = none)]
        pub unsafe fn signpostName(&self) -> Retained<NSString>;

        /// The signpost type associated with this entry.
        #[unsafe(method(signpostType))]
        #[unsafe(method_family = none)]
        pub unsafe fn signpostType(&self) -> OSLogEntrySignpostType;
    );
}

/// Methods declared on superclass `NSObject`.
impl OSLogEntrySignpost {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// Control the direction of the iteration.
///
///
/// Iterate backward in time. If no starting position is specified,
/// start at the latest entry.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogenumeratoroptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct OSLogEnumeratorOptions(pub NSUInteger);
bitflags::bitflags! {
    impl OSLogEnumeratorOptions: NSUInteger {
        #[doc(alias = "OSLogEnumeratorReverse")]
        const Reverse = 0x01;
    }
}

unsafe impl Encode for OSLogEnumeratorOptions {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for OSLogEnumeratorOptions {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// An enumerator that views entries in the unified logging system.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogenumerator?language=objc)
    #[unsafe(super(NSEnumerator, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct OSLogEnumerator;
);

extern_conformance!(
    unsafe impl NSFastEnumeration for OSLogEnumerator {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for OSLogEnumerator {}
);

impl OSLogEnumerator {
    extern_methods!();
}

/// Methods declared on superclass `NSObject`.
impl OSLogEnumerator {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// The kind of data corresponding to an argument in a message
/// payload, like the number associated with a "%d" placeholder.
/// This value can be undefined if the argument data cannot be
/// decoded; for example, it may be redacted.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogmessagecomponentargumentcategory?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct OSLogMessageComponentArgumentCategory(pub NSInteger);
impl OSLogMessageComponentArgumentCategory {
    #[doc(alias = "OSLogMessageComponentArgumentCategoryUndefined")]
    pub const Undefined: Self = Self(0);
    #[doc(alias = "OSLogMessageComponentArgumentCategoryData")]
    pub const Data: Self = Self(1);
    #[doc(alias = "OSLogMessageComponentArgumentCategoryDouble")]
    pub const Double: Self = Self(2);
    #[doc(alias = "OSLogMessageComponentArgumentCategoryInt64")]
    pub const Int64: Self = Self(3);
    #[doc(alias = "OSLogMessageComponentArgumentCategoryString")]
    pub const String: Self = Self(4);
    #[doc(alias = "OSLogMessageComponentArgumentCategoryUInt64")]
    pub const UInt64: Self = Self(5);
}

unsafe impl Encode for OSLogMessageComponentArgumentCategory {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for OSLogMessageComponentArgumentCategory {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// The message arguments for a particular entry. There is one
    /// component for each placeholder in the formatString plus one
    /// component for any text after the last placeholder.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogmessagecomponent?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct OSLogMessageComponent;
);

extern_conformance!(
    unsafe impl NSCoding for OSLogMessageComponent {}
);

extern_conformance!(
    unsafe impl NSObjectProtocol for OSLogMessageComponent {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for OSLogMessageComponent {}
);

impl OSLogMessageComponent {
    extern_methods!(
        /// The text immediately preceding a placeholder. This can be an
        /// empty string if there is nothing between two placeholders, or
        /// between the placeholder and the bounds of the string.
        #[unsafe(method(formatSubstring))]
        #[unsafe(method_family = none)]
        pub unsafe fn formatSubstring(&self) -> Retained<NSString>;

        /// The placeholder text. Is empty for is the last component.
        #[unsafe(method(placeholder))]
        #[unsafe(method_family = none)]
        pub unsafe fn placeholder(&self) -> Retained<NSString>;

        /// The type of argument corresponding to the placeholder; see
        /// OSLogMessageComponentArgumentCategory.
        #[unsafe(method(argumentCategory))]
        #[unsafe(method_family = none)]
        pub unsafe fn argumentCategory(&self) -> OSLogMessageComponentArgumentCategory;

        /// The argument as a sequence of bytes. Can be nil if the
        /// argument cannot be decoded (for example, it could be
        /// redacted), or if this is the last component.
        #[unsafe(method(argumentDataValue))]
        #[unsafe(method_family = none)]
        pub unsafe fn argumentDataValue(&self) -> Option<Retained<NSData>>;

        /// The argument as a double-precision floating point number; the
        /// value is undefined if the argument cannot be decoded or if this
        /// is the last component.
        #[unsafe(method(argumentDoubleValue))]
        #[unsafe(method_family = none)]
        pub unsafe fn argumentDoubleValue(&self) -> c_double;

        /// The argument as a 64-bit signed integer; the value is undefined
        /// if it cannot be decoded or if this is the last component.
        #[unsafe(method(argumentInt64Value))]
        #[unsafe(method_family = none)]
        pub unsafe fn argumentInt64Value(&self) -> i64;

        /// The argument as a number. Can be nil if the argument cannot
        /// be decoded (for example, it could be redacted), or if this is
        /// the last component.
        #[unsafe(method(argumentNumberValue))]
        #[unsafe(method_family = none)]
        pub unsafe fn argumentNumberValue(&self) -> Option<Retained<NSNumber>>;

        /// The argument as a string. Can be nil if the argument cannot
        /// be decoded (for example, it could be redacted), or if this is
        /// the last component.
        #[unsafe(method(argumentStringValue))]
        #[unsafe(method_family = none)]
        pub unsafe fn argumentStringValue(&self) -> Option<Retained<NSString>>;

        /// The argument as a 64-bit unsigned integer; the value is
        /// undefined if the argument cannot be decoded or if this is the
        /// last component.
        #[unsafe(method(argumentUInt64Value))]
        #[unsafe(method_family = none)]
        pub unsafe fn argumentUInt64Value(&self) -> u64;
    );
}

/// Methods declared on superclass `NSObject`.
impl OSLogMessageComponent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// An opaque abstraction representing a point in a sequence of
    /// entries in the unified logging system.
    ///
    ///
    /// Generate positions with OSLogStore instance methods and use them
    /// to start viewing entries from a particular starting point.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogposition?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct OSLogPosition;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for OSLogPosition {}
);

impl OSLogPosition {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl OSLogPosition {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// Create a store to a subset of the libtrace entries.
///
///
///
/// "System" scope indicates the entire system; i.e., all logs. Entries can be
/// retrieved for the current calling process, i.e., matching pid.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogstorescope?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct OSLogStoreScope(pub NSInteger);
impl OSLogStoreScope {
    #[doc(alias = "OSLogStoreSystem")]
    pub const System: Self = Self(0);
    #[doc(alias = "OSLogStoreCurrentProcessIdentifier")]
    pub const CurrentProcessIdentifier: Self = Self(1);
}

unsafe impl Encode for OSLogStoreScope {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for OSLogStoreScope {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    /// A set of entries from the unified logging system. Instances
    /// represent a fixed range of entries and may be backed by a
    /// logarchive or the Mac's local store.
    ///
    ///
    /// Entries in OSLogStore objects are used by OSLogEnumerator
    /// instances; one store can support multiple OSLogEnumerator
    /// instances concurrently.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/oslog/oslogstore?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct OSLogStore;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for OSLogStore {}
);

impl OSLogStore {
    extern_methods!(
        /// Create an OSLogStore representing the Mac's local store.
        ///
        ///
        /// Parameter `error`: If initialization is unsuccessful --- for example, this process
        /// does not have access to local logs --- return nil and set this
        /// parameter to a pointer to an error object describing the reason.
        ///
        ///
        /// This enables processing of a sequence of logs as of the particular
        /// point in time when this object is created.
        ///
        /// Gaining access to the local unified logging system requires
        /// permission from the system. The caller must be run by an admin
        /// account.
        #[unsafe(method(localStoreAndReturnError:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn localStoreAndReturnError() -> Result<Retained<Self>, Retained<NSError>>;

        /// Create an OSLogStore for a subset of entries in the local store.
        ///
        ///
        /// Parameter `scope`: The kind of subset the OSLogStore is for.
        ///
        ///
        /// Parameter `error`: If initialization is unsuccessful, return nil and set this parameter to a
        /// pointer to an error object that describes the reason.
        #[unsafe(method(storeWithScope:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn storeWithScope_error(
            scope: OSLogStoreScope,
        ) -> Result<Retained<Self>, Retained<NSError>>;

        /// Create an OSLogStore based on a logarchive.
        ///
        ///
        /// Parameter `url`: The path identifying a logarchive to be read.
        ///
        ///
        /// Parameter `error`: If initialization is unsuccessful --- for example, the path is not
        /// to a valid logarchive or the logarchive is not compatible because
        /// it is from a newer version --- return nil and set this parameter
        /// to a pointer to an error object that describes the reason.
        #[unsafe(method(storeWithURL:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn storeWithURL_error(url: &NSURL) -> Result<Retained<Self>, Retained<NSError>>;

        #[deprecated = "Use one of the factory methods"]
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// Return an OSLogEnumerator object based on an underlying store.
        /// This object represents the sequence of entries for the store.
        /// OSLogStore. Additional parameters control which entries are
        /// yielded and their order.
        ///
        ///
        /// Parameter `options`: Control the direction of iteration.
        ///
        ///
        /// Parameter `position`: Where to start iteration. If nil, depend on the direction of
        /// the iteration: if forwards, start with the earliest entry; if
        /// reverse, start with the latest entry.
        ///
        ///
        /// Parameter `predicate`: A predicate that filters which entries are in the sequence. If
        /// this is nil, yield all entries.
        ///
        ///
        /// Parameter `error`: If the enumerator cannot be set up --- for example, the
        /// predicate has an unrecognized key --- return nil and set this
        /// to a pointer to an error object that describes the reason.
        #[unsafe(method(entriesEnumeratorWithOptions:position:predicate:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn entriesEnumeratorWithOptions_position_predicate_error(
            &self,
            options: OSLogEnumeratorOptions,
            position: Option<&OSLogPosition>,
            predicate: Option<&NSPredicate>,
        ) -> Result<Retained<OSLogEnumerator>, Retained<NSError>>;

        /// Return an OSLogEnumerator object with default options for
        /// viewing the entries; all are viewed, from earliest to latest.
        ///
        ///
        /// Parameter `error`: If the enumerator cannot be set up, return nil and set this
        /// to a pointer to an error object that describes the reason.
        #[unsafe(method(entriesEnumeratorAndReturnError:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn entriesEnumeratorAndReturnError(
            &self,
        ) -> Result<Retained<OSLogEnumerator>, Retained<NSError>>;

        /// Return a position representing the time specified.
        ///
        ///
        /// Parameter `date`: The date to look for.
        ///
        ///
        /// If there are multiple occurences of the same time --- if, for
        /// example, there was a time change during the range of entries
        /// --- the earliest occurrence is used.
        #[unsafe(method(positionWithDate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn positionWithDate(&self, date: &NSDate) -> Retained<OSLogPosition>;

        /// Return a position representing an offset since the end of the time
        /// range that the entries span.
        ///
        ///
        /// Parameter `seconds`: The seconds to add to the last time point in the range of entries.
        #[unsafe(method(positionWithTimeIntervalSinceEnd:))]
        #[unsafe(method_family = none)]
        pub unsafe fn positionWithTimeIntervalSinceEnd(
            &self,
            seconds: NSTimeInterval,
        ) -> Retained<OSLogPosition>;

        /// Return a position representing time since the last boot in the
        /// series of entries.
        ///
        ///
        /// Parameter `seconds`: The seconds to add to the boot time point in the log time range.
        ///
        ///
        /// Negative seconds would create an ambiguous or imprecise position;
        /// this function asserts that the interval is positive.
        #[unsafe(method(positionWithTimeIntervalSinceLatestBoot:))]
        #[unsafe(method_family = none)]
        pub unsafe fn positionWithTimeIntervalSinceLatestBoot(
            &self,
            seconds: NSTimeInterval,
        ) -> Retained<OSLogPosition>;
    );
}

/// Methods declared on superclass `NSObject`.
impl OSLogStore {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}