fix(ios): logging format strings (#266)

This commit is contained in:
Nathan Van Fleet
2022-04-06 17:16:19 -07:00
committed by GitHub
parent 87bb49250e
commit b3a4f1686d
2 changed files with 24 additions and 6 deletions

View File

@@ -53,13 +53,21 @@ static MGLNativeNetworkManager *instance = nil;
}
- (void)debugLog:(NSString *)format, ... {
// TODO: Replace with existing mbgl logging handling.
[self.delegate debugLog:format];
va_list formatList;
va_start(formatList, format);
NSString *formattedMessage = [[NSString alloc] initWithFormat:format arguments:formatList];
va_end(formatList);
[self.delegate debugLog:formattedMessage];
}
- (void)errorLog:(NSString *)format, ... {
// TODO: Replace with existing mbgl logging handling.
[self.delegate errorLog:format];
va_list formatList;
va_start(formatList, format);
NSString *formattedMessage = [[NSString alloc] initWithFormat:format arguments:formatList];
va_end(formatList);
[self.delegate errorLog:formattedMessage];
}
@end

View File

@@ -122,11 +122,21 @@ NSString * const kMGLDownloadPerformanceEvent = @"mobile.performance_trace";
}
- (void)debugLog:(NSString *)format, ... {
MGLLogDebug(format);
va_list formatList;
va_start(formatList, format);
NSString *formattedMessage = [[NSString alloc] initWithFormat:format arguments:formatList];
va_end(formatList);
MGLLogDebug(formattedMessage);
}
- (void)errorLog:(NSString *)format, ... {
MGLLogError(format);
va_list formatList;
va_start(formatList, format);
NSString *formattedMessage = [[NSString alloc] initWithFormat:format arguments:formatList];
va_end(formatList);
MGLLogError(formattedMessage);
}
#pragma mark - Event management