Skip to content

Commit 65cfa73

Browse files
author
Matthew Davis
committed
[Obj-C] removed extraneous logs unless logging is specifically enabled in the [SWGConfiguration sharedConfig] instance
1 parent 27e434d commit 65cfa73

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

modules/swagger-codegen/src/main/resources/objc/ApiClient-body.mustache

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ static void (^reachabilityChangeBlock)(int);
7575
[config.loggingFileHanlder writeData:[message dataUsingEncoding:NSUTF8StringEncoding]];
7676
}
7777

78-
NSLog(@"%@", message);
78+
if ([[{{classPrefix}}Configuration sharedConfig] debug]){
79+
NSLog(@"%@", message);
80+
}
7981
}
8082

8183
#pragma mark - Cache Methods
@@ -177,8 +179,9 @@ static void (^reachabilityChangeBlock)(int);
177179

178180
+(NSNumber*) queueRequest {
179181
NSNumber* requestId = [{{classPrefix}}ApiClient nextRequestId];
180-
if([[{{classPrefix}}Configuration sharedConfig] debug])
182+
if([[{{classPrefix}}Configuration sharedConfig] debug]) {
181183
NSLog(@"added %@ to request queue", requestId);
184+
}
182185
[queuedRequests addObject:requestId];
183186
return requestId;
184187
}
@@ -198,8 +201,9 @@ static void (^reachabilityChangeBlock)(int);
198201
}];
199202

200203
if(matchingItems.count == 1) {
201-
if([[{{classPrefix}}Configuration sharedConfig] debug])
204+
if([[{{classPrefix}}Configuration sharedConfig] debug]){
202205
NSLog(@"removing request id %@", requestId);
206+
}
203207
[queuedRequests removeObject:requestId];
204208
return YES;
205209
}
@@ -576,15 +580,21 @@ static void (^reachabilityChangeBlock)(int);
576580
hasHeaderParams = true;
577581
}
578582
if(offlineState) {
579-
NSLog(@"%@ cache forced", resourcePath);
583+
if ([[{{classPrefix}}Configuration sharedConfig] debug]){
584+
NSLog(@"%@ cache forced", resourcePath);
585+
}
580586
[request setCachePolicy:NSURLRequestReturnCacheDataDontLoad];
581587
}
582588
else if(!hasHeaderParams && [method isEqualToString:@"GET"] && cacheEnabled) {
583-
NSLog(@"%@ cache enabled", resourcePath);
589+
if ([[{{classPrefix}}Configuration sharedConfig] debug]){
590+
NSLog(@"%@ cache enabled", resourcePath);
591+
}
584592
[request setCachePolicy:NSURLRequestUseProtocolCachePolicy];
585593
}
586594
else {
587-
NSLog(@"%@ cache disabled", resourcePath);
595+
if ([[{{classPrefix}}Configuration sharedConfig] debug]){
596+
NSLog(@"%@ cache disabled", resourcePath);
597+
}
588598
[request setCachePolicy:NSURLRequestReloadIgnoringLocalCacheData];
589599
}
590600

0 commit comments

Comments
 (0)