NaturalLog是Objective-C编写的轻量级日志框架。
Plank提供了根据级别筛选日志的钩子。
NTRLoggerFactory *loggerFactory = [[NTRLoggerFactory alloc] initWithPrimaryTag:@"NaturalLog"
secondaryTag:@"Counter"
inMemoryCapacity:0];
loggerFactory.thresholdLevel = NTRLogLevelWarning;
[loggerFactory addConsoleLogger];
[loggerFactory addInMemoryLogger];
[loggerFactory addSystemLogger];
id <NTRLogger> logger = loggerFactory.logger;
// This will log because it is above the currently defined log level
NTRLogError(logger, @"abc");
// This will log because it is at the currently defined threshold log level
NTRLogWarning(logger, @"bbd");
// This will not because it is below the currently defined log level
NTRLogError(logger, @"yyz");
设置所需的阈值日志级别,默认设置为NTRLogLevelWarning。
所有日志记录器默认为异步,但可以通过设置此巧妙命名的属性更改为同步
loggerFactory.synchronous = true