77
77
78
78
void FIRLoggerInitializeASL () {
79
79
dispatch_once (&sFIRLoggerOnceToken , ^{
80
+ NSInteger majorOSVersion = [[FIRAppEnvironmentUtil systemVersion ] integerValue ];
81
+ uint32_t aslOptions = ASL_OPT_STDERR;
82
+ #if TARGET_OS_SIMULATOR
83
+ // The iOS 11 simulator doesn't need the ASL_OPT_STDERR flag.
84
+ if (majorOSVersion >= 11 ) {
85
+ aslOptions = 0 ;
86
+ }
87
+ #else
88
+ // Devices running iOS 10 or higher don't need the ASL_OPT_STDERR flag.
89
+ if (majorOSVersion >= 10 ) {
90
+ aslOptions = 0 ;
91
+ }
92
+ #endif // TARGET_OS_SIMULATOR
93
+
80
94
// Initialize the ASL client handle.
81
- sFIRLoggerClient = asl_open (NULL , kFIRLoggerASLClientFacilityName , ASL_OPT_STDERR );
95
+ sFIRLoggerClient = asl_open (NULL , kFIRLoggerASLClientFacilityName , aslOptions );
82
96
83
97
// Set the filter used by system/device log. Initialize in default mode.
84
98
asl_set_filter (sFIRLoggerClient , ASL_FILTER_MASK_UPTO (ASL_LEVEL_NOTICE));
@@ -104,11 +118,15 @@ void FIRLoggerInitializeASL() {
104
118
sFIRLoggerDebugMode = NO ;
105
119
}
106
120
107
- // Need to call asl_add_output_file so that the logs can appear in Xcode's console view. Set
108
- // the ASL filter mask for this output file up to debug level so that all messages are
109
- // viewable in the console.
110
- asl_add_output_file (sFIRLoggerClient , STDERR_FILENO, kFIRLoggerCustomASLMessageFormat ,
111
- ASL_TIME_FMT_LCL, ASL_FILTER_MASK_UPTO (ASL_LEVEL_DEBUG), ASL_ENCODE_SAFE);
121
+ #if TARGET_OS_SIMULATOR
122
+ // Need to call asl_add_output_file so that the logs can appear in Xcode's console view when
123
+ // running iOS 7. Set the ASL filter mask for this output file up to debug level so that all
124
+ // messages are viewable in the console.
125
+ if (majorOSVersion == 7 ) {
126
+ asl_add_output_file (sFIRLoggerClient , STDERR_FILENO, kFIRLoggerCustomASLMessageFormat ,
127
+ ASL_TIME_FMT_LCL, ASL_FILTER_MASK_UPTO (ASL_LEVEL_DEBUG), ASL_ENCODE_SAFE);
128
+ }
129
+ #endif // TARGET_OS_SIMULATOR
112
130
113
131
sFIRClientQueue = dispatch_queue_create (" FIRLoggingClientQueue" , DISPATCH_QUEUE_SERIAL);
114
132
dispatch_set_target_queue (sFIRClientQueue ,
0 commit comments