Latest 0.0.2
Homepage https://github.com/vinhnx/NXVLogFormatter
License MIT
Platforms ios , requires ARC
Dependencies CocoaLumberjack
Authors

NXVLogFormatter

Cocoapods Badge Build Status
License

Simple custom log formatter for the awesome CocoaLumberjack.

It logs output with following pattern:

(Date, Time) -[FileName MethodName](line number): "LogMessage"

Why?

Because traditional NSLog() is not debug-friendly et al.

How

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/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;
}

Or, you can open the sample project for your reference.

Screenshot

Here is what it looks like with CocoaLumberjack‘s built-in color mode in Xcode Console.
screenshot

Installation

Automatic

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; open YourProject.xcworkspace

Manually

Just drag both NXVLogFormatter.{h,m} files to your project and start using it like this.

Sweet Source

I don’t see color formatter in my Xcode debugger!

You can fix it in a few seconds. Here’s how.

  1. In Xcode bring up the Scheme Editor (Product -> Edit Scheme…)
  2. Select "Run" (on the left), and then the "Arguments" tab
  3. Add a new Environment Variable named "XcodeColors", with a value of "YES"

link

License

See LICENSE.

Contact

I’m @vinhnx on almost anywhere.

Bitdeli Badge

Latest podspec

{
    "name": "NXVLogFormatter",
    "version": "0.0.2",
    "summary": "Simple custom log formatter for CocoaLumberjack.",
    "description": "                    Because traditional NSLog() is not debug-friendly et al. NXVLogFormatter simplify that with following pattern:nn                    ```n                    (Date, Time) -[FileName MethodName](line number): "LogMessage"n                    ```n",
    "homepage": "https://github.com/vinhnx/NXVLogFormatter",
    "screenshots": "https://raw.github.com/vinhnx/NXVLogFormatter/master/screenshot/NXVLogFormatter-ss.png",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Vinh Nguyen": "[email protected]"
    },
    "social_media_url": "https://twitter.com/vinhnx",
    "source": {
        "git": "https://github.com/vinhnx/NXVLogFormatter.git",
        "tag": "0.0.2"
    },
    "dependencies": {
        "CocoaLumberjack": [
            "~> 1.8.1"
        ]
    },
    "source_files": "NXVLogFormatter/*.{m,h}",
    "requires_arc": true,
    "platforms": {
        "ios": null
    }
}

Pin It on Pinterest

Share This