TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Dec 2014 |
Maintained by Unclaimed.
Simple custom log formatter for the awesome CocoaLumberjack.
It logs output with following pattern:
(Date, Time) -[FileName MethodName](line number): "LogMessage"
Because traditional NSLog() is not debug-friendly et al
Just add couple lines and you are up and running
// first, you need to import CocoaLumberjack files
#import "DDLog.h"
#import "DDTTYLogger.h"
#import "DDASLLogger.h"
// then, you could also add NXVLogFormatter whenever you need it
#import "NXVLogFormatter.h"
// setup logger
- (void)initializeLogger
{
// required, setup DDLog
[DDLog addLogger:[DDASLLogger sharedInstance]];
[DDLog addLogger:[DDTTYLogger sharedInstance]];
// use NXVLogFormatter as custom log formmater
[[DDTTYLogger sharedInstance] setLogFormatter:[NXVLogFormatter new]];
// optional, enable colors
[[DDTTYLogger sharedInstance] setColorsEnabled:YES];
}
// then in application:didFinishLaunchingWithOptions:, just bind
// that log method to it
- (BOOL) application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// initialize it
[self initializeLogger];
// ...
return YES;
}
Here is what it looks like with CocoaLumberjack's built-in color mode in Xcode Console.
If you use Cocoapods, you can add pod 'NXVLogFormatter'
to your Podfile
. Then run pod install
to integrate NXVLogFormatter to your project, like so:
# somewhere in your Podfile
pod 'NXVLogFormatter'
then just install and open your project's workspace:
pod install --verbose && YourProject.xcworkspace
Just drag both NXVLogFormatter.{h,m}
files to your project and start using it like this.
See LICENSE.
I'm @vinhnx on almost anywhere.