-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDebugLog.h
36 lines (28 loc) · 1.08 KB
/
DebugLog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// DebugLog.h
//
// Created by Jeremy Olmsted-Thompson on 12/22/11.
// Copyright (c) 2011 JOT. All rights reserved.
//
#import <Foundation/Foundation.h>
// Define DEBUG here or configure it as a preprocessor macro in your project settings. Using
// project settings allows the log to automatically be disabled for release builds.
#ifdef DEBUG
#define DLog(...) \
[[DebugLog defaultLog] log:[NSString stringWithFormat:@"%s (%@: %d): %@", __PRETTY_FUNCTION__, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:__VA_ARGS__]]]
#else
#define DLog(...)
#endif
#ifdef DEBUG
#define DLogThread(...) \
[[DebugLog defaultLog] log:[NSString stringWithFormat:@"%s (%@: %d) %@: %@", __PRETTY_FUNCTION__, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSThread currentThread], [NSString stringWithFormat:__VA_ARGS__]]]
#else
#define DLogThread(...)
#endif
@interface DebugLog : NSObject {
NSFileHandle *logFileHandle;
}
-(id)initWithLogFilePath:(NSString*)path;
-(void)log:(NSString*)logString;
+(DebugLog*)defaultLog;
@end