mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00

git-subtree-dir: submodules/HockeySDK-iOS git-subtree-mainline: 085acd26c4432939403765234266e3c1be0f3dd9 git-subtree-split: c7d0c7026303253e2ac576c02655691e5d314fe2
43 lines
1.2 KiB
Objective-C
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
|