Skip to content
/ HKDebug Public

Another custom debug log with colors (based in SwiftyBeaver but for Objective-C) with help of XcodeColors

License

Notifications You must be signed in to change notification settings

hunk/HKDebug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI Status Packagist Platform Language Objective-c

HKDebug

Another custom debug log with colors (based in SwiftyBeaver but for Objective-C) with help of XcodeColors

I love SwiftyBeaver, it is a realy good. but i have some projects in Objective-C and i want the same output for the Xcode console. SwiftyBeaver already has a wrapper SBObjectiveCWrapper for Objective-C but it requires an AppDelegate in Swift. By the way if your old proyects are all in Objective-C, then you need change your AppDelegate to swfit version, add SwiftyBeaver and SBObjectiveCWrapper, set the options for SwiftyBeaver.

For that reason I decided to make this little class (functions and macros) in order to have the same output.

##Installation

###CocoaPods ToDo: add CocoaPods file

###Download

  1. Download the Repository
  2. Drag & drop the HKDebug.[h|m] files from /Classes into your project (make sure "Copy items if needed" is checked)

###Usage

Add #import "HKDebug.h" in your files where you need or if you use .pch add here and uses in all your files.

Now you can use the follow functions:

    // Debug log \o/
    HKNormal(@"normal log without color, but whit the format of HK");
    HKVerbose(@"normal log with Verbose in gray");
    HKDebug(@"this line is with a debug word in %@",@"blue");
    HKInfo(@"a info log");
    HKWarning(@"oh, no, oh no, this is not happening");
    HKError(@"aahhhhh, help!!!!!!");
    HKAlt(@"alternative color");
    HKOpt(@"optional color");
    
    //All lines is in color
    HKFullColor(true);
    HKVerbose(@"this is a integer %zd",123);
    HKInfo(@"and this is a float %f",-123.45678);
    HKWarning(@"a date:%@",[NSDate date]);
    HKError(@"array %@",@[@"item 1", @"item 2", @"item 3"]);
    HKAlt(@"dictionary %@",@{@"name": @"Edgar G", @"nick": @"@hunk"});

###Options You can choosen the elements for the output. this simples macros enable o disable some elements of the log.

HKFullColor(true); // all the line is in color, default value is false
HKShowDate(false); // show/hide datetime in the log, default value is true
HKShowFile(false); // show/hide name of file in the log, default value is true
HKShowFunc(false); // show/hide name of function in the log, default value is true
HKShowLine(false); // show/hide line number in the log, default value is true

###ToDo

output in a file

###Don't show colors? Check if you have installed XcodeColors

  • Testing to see if XcodeColors is installed and enabled:

    char *xcode_colors = getenv("XcodeColors");
    if (xcode_colors && (strcmp(xcode_colors, "YES") == 0))
    {
    // XcodeColors is installed and enabled!
    }

##License

HKDebug is released under the MIT License.

About

Another custom debug log with colors (based in SwiftyBeaver but for Objective-C) with help of XcodeColors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published