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