forked from aharren/LibComponentLogging-NSLogger
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathLCLNSLogger_RK.h
150 lines (130 loc) · 5.38 KB
/
LCLNSLogger_RK.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
//
//
// LCLNSLogger_RK.h
//
//
// Copyright (c) 2010-2011 Arne Harren <ah@0xc0.de>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#define _LCLNSLOGGER_VERSION_MAJOR 1
#define _LCLNSLOGGER_VERSION_MINOR 0
#define _LCLNSLOGGER_VERSION_BUILD 4
#define _LCLNSLOGGER_VERSION_SUFFIX ""
//
// LCLNSLogger
//
// LCLNSLogger is a logging back-end for LibComponentLogging which integrates
// the logging client from Florent Pillet's NSLogger project.
//
// See http://github.com/fpillet/NSLogger for more details about NSLogger.
//
// LCLNSLogger is configured via the following #defines in LCLNSLoggerConfig.h
// (see #import below):
//
// - Show file names in the log messages? (type BOOL)
// #define _LCLNSLogger_ShowFileNames <definition>
//
// - Show line numbers in the log messages? (type BOOL)
// #define _LCLNSLogger_ShowLineNumbers <definition>
//
// - Show function names in the log messages? (type BOOL)
// #define _LCLNSLogger_ShowFunctionNames <definition>
//
// - Set the NSLogger option LogToConsole? (type BOOL)
// #define _LCLNSLogger_LogToConsole <definition>
//
// - Set the NSLogger option BufferLocallyUntilConnection? (type BOOL)
// #define _LCLNSLogger_BufferLocallyUntilConnection <definition>
//
// - Set the NSLogger option BrowseBonjour? (type BOOL)
// #define _LCLNSLogger_BrowseBonjour <definition>
//
// - Set the NSLogger option BrowseOnlyLocalDomains? (type BOOL)
// #define _LCLNSLogger_BrowseOnlyLocalDomains <definition>
//
// - Set the NSLogger option UseSSL? (type BOOL)
// #define _LCLNSLogger_UseSSL <definition>
//
// For using LCLNSLogger with LibComponentLogging, simply add an
// #import "LCLNSLogger.h"
// statement to your lcl_config_logger.h file and use the LCLNSLoggerConfig.h
// file for detailed configuration of the LCLNSLogger class.
//
// In addition to the LCLNSLogger files, you need the following files from
// the Client Logger folder from the NSLogger project:
//
// LoggerClient.h
// LoggerClient.m
// LoggerCommon.h
//
// You can download them from here: http://github.com/fpillet/NSLogger
//
// In your project, you must link the following frameworks:
//
// SystemConfiguration.framework
// CFNetwork.framework / CoreServices.framework
//
#import <Foundation/Foundation.h>
#import "LCLNSLoggerConfig.h"
@interface LCLNSLogger_RK : NSObject {
}
//
// Logging methods.
//
// Writes the given log message to the log.
+ (void)logWithComponent:(_RKlcl_component_t)component level:(uint32_t)level
path:(const char *)path line:(uint32_t)line
function:(const char *)function
format:(NSString *)format, ... __attribute__((format(__NSString__, 6, 7)));
@end
//
// Integration with LibComponentLogging Core.
//
// ARC/non-ARC autorelease pool
#define _RKlcl_logger_autoreleasepool_arc 0
#if defined(__has_feature)
# if __has_feature(objc_arc)
# undef _RKlcl_logger_autoreleasepool_arc
# define _RKlcl_logger_autoreleasepool_arc 1
# endif
#endif
#if _RKlcl_logger_autoreleasepool_arc
#define _RKlcl_logger_autoreleasepool_begin \
@autoreleasepool {
#define _RKlcl_logger_autoreleasepool_end \
}
#else
#define _RKlcl_logger_autoreleasepool_begin \
NSAutoreleasePool *_RKlcl_logger_autoreleasepool = [[NSAutoreleasePool alloc] init];
#define _RKlcl_logger_autoreleasepool_end \
[_RKlcl_logger_autoreleasepool release];
#endif
// Define the _RKlcl_logger macro which integrates LCLNSLogger as a logging
// back-end for LibComponentLogging.
#define _RKlcl_logger(_component, _level, _format, ...) { \
_RKlcl_logger_autoreleasepool_begin \
[LCLNSLogger logWithComponent:_component \
level:_level \
path:__FILE__ \
line:__LINE__ \
function:__PRETTY_FUNCTION__ \
format:_format, \
## __VA_ARGS__]; \
_RKlcl_logger_autoreleasepool_end \
}