@@ -258,38 +258,26 @@ - (void) testRemoteLogLevels {
258
258
#if !TARGET_OS_WATCH
259
259
- (void ) testAutoCollectedLogs {
260
260
[NRMAFlags enableFeatures: NRFeatureFlag_RedirectStdOutStdErr];
261
- // Set the remote log level to Info .
261
+ // Set the remote log level to debug .
262
262
[NRLogger setRemoteLogLevel: NRLogLevelDebug];
263
263
[NRAutoLogCollector redirectStandardOutputAndError ];
264
264
265
- XCTestExpectation *delayExpectation1 = [self expectationWithDescription: @" Waiting for Log Queue" ];
266
-
267
- dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(5 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^{
268
- [delayExpectation1 fulfill ];
269
- });
270
-
271
- [self waitForExpectationsWithTimeout: 5 handler: ^(NSError * _Nullable error) {
272
- if (error) {
273
- XCTFail (@" Timeout error" );
274
- }
275
- }];
276
-
277
265
// Three messages should reach the remote log file for upload.
278
- NSLog (@" NSLog Test \n " );
266
+ NSLog (@" NSLog Test \n\n " );
279
267
os_log_t customLog = os_log_create (" com.agent.tests" , " logTest" );
280
268
// Log messages at different levels
281
- os_log (customLog, " This is a default os_log message." );
282
- os_log_info (customLog, " This is an info os_log message." );
283
- os_log_error (customLog, " This is an error os_log message." );
284
- os_log_fault (customLog, " This is a fault os_log message." );
269
+ os_log (customLog, " This is a default os_log message.\n " );
270
+ os_log_info (customLog, " This is an info os_log message.\n " );
271
+ os_log_error (customLog, " This is an error os_log message.\n " );
272
+ os_log_fault (customLog, " This is a fault os_log message.\n " );
285
273
286
274
XCTestExpectation *delayExpectation2 = [self expectationWithDescription: @" Waiting for Log Queue" ];
287
275
288
- dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(2 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^{
276
+ dispatch_after (dispatch_time (DISPATCH_TIME_NOW, (int64_t )(5 * NSEC_PER_SEC)), dispatch_get_main_queue (), ^{
289
277
[delayExpectation2 fulfill ];
290
278
});
291
279
292
- [self waitForExpectationsWithTimeout: 5 handler: ^(NSError * _Nullable error) {
280
+ [self waitForExpectationsWithTimeout: 8 handler: ^(NSError * _Nullable error) {
293
281
if (error) {
294
282
XCTFail (@" Timeout error" );
295
283
}
@@ -315,7 +303,7 @@ - (void) testAutoCollectedLogs {
315
303
@{@" message" : @" This is an error os_log message." },
316
304
@{@" message" : @" This is a fault os_log message." },
317
305
];
318
- // check for existence of 6 logs.
306
+ // check for existence of 5 logs.
319
307
int foundCount = 0 ;
320
308
// For each expected message.
321
309
for (NSDictionary *dict in expectedValues) {
0 commit comments