Giter Site home page Giter Site logo

echoliao / nxvlogformatter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prashantsharma15/nxvlogformatter

1.0 1.0 0.0 506 KB

Custom CocoaLumberjack log

Home Page: http://vinhnx.github.io/NXVLogFormatter/

License: MIT License

Objective-C 86.49% Ruby 13.51%

nxvlogformatter's Introduction

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

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

License

See LICENSE.

Contact

I'm @vinhnx on almost anywhere.

Bitdeli Badge

nxvlogformatter's People

Contributors

vinhnx avatar echoliao avatar bitdeli-chef avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.