TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
Depends on: | |
DVFloatingWindow | >= 0 |
CocoaLumberjack | >= 0 |
DVFloatingLumberjack is a bridge between DVFloatingWindow and CocoaLumberjack.
To use DVFloatingLumberjack you have to install DVFloatingWindow and CocoaLumberjack first.
There are two possible methods to include DVFloatingWindow in your project:
Using CocoaPods:
pod 'DVFloatingLumberjack'
pod install
Manually:
Initialize DVLumberjackLogger (perhaps in your AppDelegate file).
#import "DVLumberjackLogger.h"
...
DVLumberjackLogger *dvLogger = [DVLumberjackLogger new];
// logging all logs to Default logger
[dvLogger attachFloatingLogger:@"Default" toLumberjackLogLevel:LOG_LEVEL_VERBOSE];
[DDLog addLogger:dvLogger];
You can log all errors to separate logger.
// logging all errors to Errors logger
[dvLogger attachFloatingLogger:@"Errors" toLumberjackLogLevel:LOG_LEVEL_ERROR];
CocoaLumberjack's logLevel is a bitmask, created from log flags (there are five of them by default):
You can add any combination of flags and attach log to it.
// only warn logs go here
[dvLogger attachFloatingLogger:@"Warn" toLumberjackLogLevel:LOG_FLAG_WARN];
// this is non-errors logger
[dvLogger attachFloatingLogger:@"Non errors"
toLumberjackLogLevel:LOG_FLAG_INFO | LOG_FLAG_DEBUG | LOG_FLAG_VERBOSE];
If you want you can dynamically attach and remove log levels to DVFloatingWindow.
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// all logs are related to GalleryController while it's visible
[dvLogger attachFloatingLogger:@"GalleryController" toLumberjackLogLevel:LOG_LEVEL_INFO];
}
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
[dvLogger removeFloatingLogger:@"GalleryController" fromLumberjackLogLevel:LOG_LEVEL_INFO];
}
Or even attach/remove logs directly from window.
DVButtonAdd(@"Start showing logs", ^{
[dvLogger attachFloatingLogger:@"Default" toLumberjackLogLevel:LOG_FLAG_VERBOSE];
});
DVButtonAdd(@"Stop showing logs", ^{
[dvLogger removeFloatingLogger:@"Default" fromLumberjackLogLevel:LOG_FLAG_VERBOSE];
});
DVFloatingLumberjack is available under the MIT license. See the LICENSE file for more info.