Skip to content

Instantly share code, notes, and snippets.

@lexrus
Created March 19, 2012 09:09
Show Gist options
  • Save lexrus/2104357 to your computer and use it in GitHub Desktop.
Save lexrus/2104357 to your computer and use it in GitHub Desktop.
NSLogger+TestFlight Macros with remote log trigger
#pragma mark - NSLogger+TestFlight
#ifdef ADHOC
#import "TestFlight.h"
#define LOG_NETWORK(level, format, ...) TFLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOG_GENERAL(level, format, ...) TFLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOG_GRAPHICS(level, format, ...) TFLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOG_MEMORY(level, format, ...) TFLog((@"%s [Line %d] " format), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
#define LOG_IMAGE(level, format, ...) do{}while(0)
#else
#if 0 // REMOTE LOG
#import "LoggerClient.h"
#define LOG_NETWORK(level, ...) {LogMessageF(__FILE__,__LINE__,__FUNCTION__,@"network",level,__VA_ARGS__);LoggerFlush(NULL,YES);}
#define LOG_GENERAL(level, ...) {LogMessageF(__FILE__,__LINE__,__FUNCTION__,@"general",level,__VA_ARGS__);LoggerFlush(NULL,YES);}
#define LOG_GRAPHICS(level, ...) {LogMessageF(__FILE__,__LINE__,__FUNCTION__,@"graphics",level,__VA_ARGS__);LoggerFlush(NULL,YES);}
#define LOG_MEMORY(level, ...) {LogMessageF(__FILE__,__LINE__,__FUNCTION__,@"memory",level,__VA_ARGS__);LoggerFlush(NULL,YES);}
#define LOG_IMAGE(level, ...) {LogImageDataF(__FILE__,__LINE__,__FUNCTION__,@"image",level,__VA_ARGS__);LoggerFlush(NULL,YES);}
#else
#ifdef DEBUG
#define LOG_NETWORK(level, ...) NSLog(__VA_ARGS__);
#define LOG_GENERAL(level, ...) NSLog(__VA_ARGS__);
#define LOG_GRAPHICS(level, ...) NSLog(__VA_ARGS__);
#define LOG_MEMORY(level, ...) NSLog(__VA_ARGS__);
#define LOG_IMAGE(level, ...)
#else
#define LOG_NETWORK(...) do{}while(0)
#define LOG_GENERAL(...) do{}while(0)
#define LOG_GRAPHICS(...) do{}while(0)
#define LOG_MEMORY(...) do{}while(0)
#define LOG_IMAGE(...) do{}while(0)
#endif
#endif
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment