2011-11-30 21:42:40 +00:00
|
|
|
//
|
2012-02-03 07:45:09 +00:00
|
|
|
// Prefix header for all source files of the 'MasterPassword' target in the 'MasterPassword' project
|
2011-11-30 21:42:40 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#import <Availability.h>
|
2012-03-13 23:55:49 +00:00
|
|
|
#import "Pearl-Prefix.pch"
|
|
|
|
|
2011-11-30 21:42:40 +00:00
|
|
|
#ifdef __OBJC__
|
2012-02-05 23:40:20 +00:00
|
|
|
|
2017-03-30 16:15:28 +00:00
|
|
|
#if TARGET_OS_MAC
|
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#else
|
2012-06-08 21:46:13 +00:00
|
|
|
#import <UIKit/UIKit.h>
|
2017-03-30 16:15:28 +00:00
|
|
|
#endif
|
|
|
|
|
2012-06-08 21:46:13 +00:00
|
|
|
#import <CoreData/CoreData.h>
|
2013-08-25 19:38:38 +00:00
|
|
|
#ifdef CRASHLYTICS
|
2017-03-06 22:25:59 +00:00
|
|
|
#import <Crashlytics/Crashlytics.h>
|
2013-08-25 19:38:38 +00:00
|
|
|
#endif
|
2017-03-30 16:15:28 +00:00
|
|
|
|
|
|
|
#if TARGET_OS_MAC
|
|
|
|
#import "MPTypes.h"
|
|
|
|
#import "MPMacConfig.h"
|
|
|
|
#else
|
2012-06-08 21:46:13 +00:00
|
|
|
#import "MPTypes.h"
|
|
|
|
#import "MPiOSConfig.h"
|
2017-03-30 16:15:28 +00:00
|
|
|
#endif
|
2011-11-30 21:42:40 +00:00
|
|
|
|
2015-09-23 04:31:33 +00:00
|
|
|
#else
|
|
|
|
|
|
|
|
#import <libgen.h>
|
|
|
|
#import <CoreFoundation/CFString.h>
|
|
|
|
#import <objc/runtime.h>
|
|
|
|
#import <objc/message.h>
|
2016-01-14 07:14:36 +00:00
|
|
|
#import <objc/NSObjCRuntime.h>
|
|
|
|
#import <stdlib.h>
|
2015-09-23 04:31:33 +00:00
|
|
|
|
2016-07-19 16:00:19 +00:00
|
|
|
#define log(level, format, ...) \
|
2016-01-14 07:14:36 +00:00
|
|
|
do { \
|
|
|
|
void (*_sendMsg)(id, SEL, CFStringRef, NSInteger, CFStringRef, NSUInteger, CFStringRef) = (void *)objc_msgSend; \
|
|
|
|
char *_msg = NULL; \
|
|
|
|
asprintf( &_msg, format, ##__VA_ARGS__ ); \
|
2016-07-19 16:00:19 +00:00
|
|
|
CFStringRef fileStr = CFStringCreateWithCString( NULL, basename( (char *)__FILE__ ), kCFStringEncodingUTF8 ); \
|
|
|
|
CFStringRef funcStr = CFStringCreateWithCString( NULL, __FUNCTION__, kCFStringEncodingUTF8 ); \
|
|
|
|
CFStringRef msgStr = CFStringCreateWithCString( NULL, _msg, kCFStringEncodingUTF8 ); \
|
2016-01-14 07:14:36 +00:00
|
|
|
_sendMsg( objc_msgSend( (id)objc_getClass( "PearlLogger" ), sel_getUid( "get" ) ), \
|
2016-07-19 16:00:19 +00:00
|
|
|
sel_getUid( "inFile:atLine:fromFunction:withLevel:text:" ), fileStr, __LINE__, funcStr, level, msgStr ); \
|
|
|
|
CFRelease( fileStr ); \
|
|
|
|
CFRelease( funcStr ); \
|
|
|
|
CFRelease( msgStr ); \
|
2016-01-14 07:14:36 +00:00
|
|
|
} while (0)
|
|
|
|
|
2016-07-19 16:00:19 +00:00
|
|
|
#define trc(format, ...) log( 0, format, ##__VA_ARGS__ );
|
|
|
|
#define dbg(format, ...) log( 1, format, ##__VA_ARGS__ );
|
|
|
|
#define inf(format, ...) log( 2, format, ##__VA_ARGS__ );
|
|
|
|
#define wrn(format, ...) log( 3, format, ##__VA_ARGS__ );
|
|
|
|
#define err(format, ...) log( 4, format, ##__VA_ARGS__ );
|
|
|
|
#define ftl(format, ...) log( 5, format, ##__VA_ARGS__ );
|
2015-09-23 04:31:33 +00:00
|
|
|
|
2012-03-13 23:55:49 +00:00
|
|
|
#endif
|