Giter VIP home page Giter VIP logo

sklogger's Introduction

SKLogger

SKLogger is a flexible, lightweight logger that removes the common hassles of the standard NSLog.

SKLog

SKLog(@"Logging things ", self.view.frame, intValue, floatValue, [ViewController class], charValue, unsignedLongValue, boolValue, @"like this");

NSLog

NSLog(@"And not like %@ %i %f %@ %c %llu %i this", NSStringFromCGRect(self.view.frame), intValue, floatValue, NSStringFromClass([ViewController class]), charValue, unsignedLongValue, boolValue);
  • No more inserting format specifiers in your log
  • Log variables in sequence (not all at the end)
  • Detailed logs that record where call originates

Streamline your debugging experience

Installation

Simply drag the file SKLogger.h into your project and #import "SKLogger.h" and you're good to go.

Usage

After importing SKLogger.h into your current file, begin making all logging calls to SKLog() and not the usual NSLog(). Follow the syntax for logging in the example below or play around with the Demo project to get a feel for it.

Source

#import "SKLogger.h"

NSString *waveEmoji = @"👋";
SKLog(@"Hi there!", waveEmoji, @"SKLogger is a flexible NSLog replacement");
SKLog(@"* No more inserting %@ signs ", @"* No more adding variables at the end ", @"* No more remembering format specifers");
    
int i = 10;
double d = 3.1415;
char c = ',';
    
SKLog(@"Just like this:", i, c, @" ", d);
    
SKLog(@"It also automatically prints out the class name (", [ViewController class], @") and method (", NSStringFromSelector(_cmd), @") you called the log from")
    
SKLog(@"Print CG structs easier than ever - ", @"Frame:", self.view.frame);
    
NSRange range = NSMakeRange(0, 100);
SKLog(@"Print ranges too ", range);
    
SKLog(@"Just #import \"SKLogger.h\" and you're good to go");
    
BOOL isAwesome = YES;
SKLog(@"Hell ", isAwesome, @"!");

Output

-[ViewController viewDidLoad]:22 Hi there!👋SKLogger is a flexible NSLog replacement
-[ViewController viewDidLoad]:23 * No more inserting %@ signs * No more adding variables at the end * No more remembering format specifers
-[ViewController viewDidLoad]:29 Just like this:10, 3.1415
-[ViewController viewDidLoad]:31 It also automatically prints out the class name (ViewController) and method (viewDidLoad) you called the log from
-[ViewController viewDidLoad]:33 Print CG structs easier than ever - Frame:{{0, 0}, {375, 667}}
-[ViewController viewDidLoad]:36 Print ranges too {0, 100}
-[ViewController viewDidLoad]:38 Just #import "SKLogger.h" and you're good to go
-[ViewController viewDidLoad]:41 Hell YES!

Note: SKLog currently only accepts 10 arguments (comma seperated values) but can easily be expanded if necessary

Support

If you have any trouble getting started with SKLogger or have discovered a bug, feel free to reach out to me on Twitter @_sachink or submit an issue/PR and I'll be sure to get in touch with you right away.

License

SKLogger is available under the MIT License. See the LICENSE for more info.

sklogger's People

Contributors

sachinkesiraju avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.