Last active
August 29, 2015 14:05
-
-
Save gdavis/870371272ffc28ee15e4 to your computer and use it in GitHub Desktop.
GDILog - Replacement for NSLog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// GDILog.h | |
// GDILog | |
// | |
// Created by Grant Davis on 8/18/14. | |
// Copyright (c) 2014 Grant Davis Interactive, LLC. All rights reserved. | |
// | |
#ifdef DEBUG | |
#include <string.h> | |
#define FILE (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) | |
#define GDILog(...) printf("%s (%d) -> %s\r", FILE, __LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String]) | |
#else | |
#define GDILog(...) | |
#endif |
Example:
GDILog(@“Hello, %@!”, @“World”);
Prints:
AppDelegate.m (20) -> Hello, World!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GDILog is an alternative to NSLog that provides a few nice things: