Peter 76e5a7fab6 Add 'submodules/HockeySDK-iOS/' from commit 'c7d0c7026303253e2ac576c02655691e5d314fe2'
git-subtree-dir: submodules/HockeySDK-iOS
git-subtree-mainline: 085acd26c4432939403765234266e3c1be0f3dd9
git-subtree-split: c7d0c7026303253e2ac576c02655691e5d314fe2
2019-06-11 18:53:14 +01:00

43 lines
1.2 KiB
Objective-C

#import "BITHockeyLoggerPrivate.h"
#import "HockeySDK.h"
@implementation BITHockeyLogger
static BITLogLevel _currentLogLevel = BITLogLevelWarning;
static BITLogHandler currentLogHandler;
BITLogHandler const defaultLogHandler = ^(BITLogMessageProvider messageProvider, BITLogLevel logLevel, const char __unused *file, const char *function, uint line) {
if (messageProvider) {
if (_currentLogLevel < logLevel) {
return;
}
NSString *functionString = [NSString stringWithUTF8String:function];
NSLog((@"[HockeySDK] %@/%d %@"), functionString, line, messageProvider());
}
};
+ (void)initialize {
currentLogHandler = defaultLogHandler;
}
+ (BITLogLevel)currentLogLevel {
return _currentLogLevel;
}
+ (void)setCurrentLogLevel:(BITLogLevel)currentLogLevel {
_currentLogLevel = currentLogLevel;
}
+ (void)setLogHandler:(BITLogHandler)logHandler {
currentLogHandler = logHandler;
}
+ (void)logMessage:(BITLogMessageProvider)messageProvider level:(BITLogLevel)loglevel file:(const char *)file function:(const char *)function line:(uint)line {
if (currentLogHandler) {
currentLogHandler(messageProvider, loglevel, file, function, line);
}
}
@end