motion-logger 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. data/.gitignore +7 -0
  2. data/Gemfile +3 -0
  3. data/README.md +48 -0
  4. data/Rakefile +15 -0
  5. data/app/app_delegate.rb +5 -0
  6. data/lib/logger/log.rb +85 -0
  7. data/lib/logger/version.rb +5 -0
  8. data/lib/motion-logger.rb +14 -0
  9. data/motion-logger.gemspec +19 -0
  10. data/spec/log_spec.rb +41 -0
  11. data/vendor/Podfile.lock +6 -0
  12. data/vendor/Pods/CocoaLumberjack/.gitignore +24 -0
  13. data/vendor/Pods/CocoaLumberjack/.hgignore +6 -0
  14. data/vendor/Pods/CocoaLumberjack/CocoaLumberjack.podspec +18 -0
  15. data/vendor/Pods/CocoaLumberjack/LICENSE.txt +18 -0
  16. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +41 -0
  17. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +99 -0
  18. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +102 -0
  19. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +618 -0
  20. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +334 -0
  21. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1346 -0
  22. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +498 -0
  23. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +979 -0
  24. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +49 -0
  25. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +186 -0
  26. data/vendor/Pods/CocoaLumberjack/README.markdown +37 -0
  27. data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +41 -0
  28. data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
  29. data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +334 -0
  30. data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +498 -0
  31. data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +49 -0
  32. data/vendor/Pods/Pods-prefix.pch +3 -0
  33. data/vendor/Pods/Pods-resources.sh +15 -0
  34. data/vendor/Pods/Pods.bridgesupport +462 -0
  35. data/vendor/Pods/Pods.xcconfig +4 -0
  36. data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
  37. metadata +104 -0
@@ -0,0 +1,498 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ /**
4
+ * Welcome to Cocoa Lumberjack!
5
+ *
6
+ * The project page has a wealth of documentation if you have any questions.
7
+ * https://github.com/robbiehanson/CocoaLumberjack
8
+ *
9
+ * If you're new to the project you may wish to read the "Getting Started" wiki.
10
+ * https://github.com/robbiehanson/CocoaLumberjack/wiki/GettingStarted
11
+ *
12
+ * Otherwise, here is a quick refresher.
13
+ * There are three steps to using the macros:
14
+ *
15
+ * Step 1:
16
+ * Import the header in your implementation file:
17
+ *
18
+ * #import "DDLog.h"
19
+ *
20
+ * Step 2:
21
+ * Define your logging level in your implementation file:
22
+ *
23
+ * // Log levels: off, error, warn, info, verbose
24
+ * static const int ddLogLevel = LOG_LEVEL_VERBOSE;
25
+ *
26
+ * Step 3:
27
+ * Replace your NSLog statements with DDLog statements according to the severity of the message.
28
+ *
29
+ * NSLog(@"Fatal error, no dohickey found!"); -> DDLogError(@"Fatal error, no dohickey found!");
30
+ *
31
+ * DDLog works exactly the same as NSLog.
32
+ * This means you can pass it multiple variables just like NSLog.
33
+ **/
34
+
35
+
36
+ @class DDLogMessage;
37
+
38
+ @protocol DDLogger;
39
+ @protocol DDLogFormatter;
40
+
41
+ /**
42
+ * Define our big multiline macros so all the other macros will be easy to read.
43
+ **/
44
+
45
+ #define LOG_MACRO(isAsynchronous, lvl, flg, ctx, fnct, frmt, ...) \
46
+ [DDLog log:isAsynchronous \
47
+ level:lvl \
48
+ flag:flg \
49
+ context:ctx \
50
+ file:__FILE__ \
51
+ function:fnct \
52
+ line:__LINE__ \
53
+ tag:nil \
54
+ format:(frmt), ##__VA_ARGS__]
55
+
56
+
57
+ #define LOG_OBJC_MACRO(async, lvl, flg, ctx, frmt, ...) \
58
+ LOG_MACRO(async, lvl, flg, ctx, sel_getName(_cmd), frmt, ##__VA_ARGS__)
59
+
60
+ #define LOG_C_MACRO(async, lvl, flg, ctx, frmt, ...) \
61
+ LOG_MACRO(async, lvl, flg, ctx, __FUNCTION__, frmt, ##__VA_ARGS__)
62
+
63
+ #define SYNC_LOG_OBJC_MACRO(lvl, flg, ctx, frmt, ...) \
64
+ LOG_OBJC_MACRO( NO, lvl, flg, ctx, frmt, ##__VA_ARGS__)
65
+
66
+ #define ASYNC_LOG_OBJC_MACRO(lvl, flg, ctx, frmt, ...) \
67
+ LOG_OBJC_MACRO(YES, lvl, flg, ctx, frmt, ##__VA_ARGS__)
68
+
69
+ #define SYNC_LOG_C_MACRO(lvl, flg, ctx, frmt, ...) \
70
+ LOG_C_MACRO( NO, lvl, flg, ctx, frmt, ##__VA_ARGS__)
71
+
72
+ #define ASYNC_LOG_C_MACRO(lvl, flg, ctx, frmt, ...) \
73
+ LOG_C_MACRO(YES, lvl, flg, ctx, frmt, ##__VA_ARGS__)
74
+
75
+
76
+ #define LOG_MAYBE(async, lvl, flg, ctx, fnct, frmt, ...) \
77
+ do { if(lvl & flg) LOG_MACRO(async, lvl, flg, ctx, fnct, frmt, ##__VA_ARGS__); } while(0)
78
+
79
+ #define LOG_OBJC_MAYBE(async, lvl, flg, ctx, frmt, ...) \
80
+ LOG_MAYBE(async, lvl, flg, ctx, sel_getName(_cmd), frmt, ##__VA_ARGS__)
81
+
82
+ #define LOG_C_MAYBE(async, lvl, flg, ctx, frmt, ...) \
83
+ LOG_MAYBE(async, lvl, flg, ctx, __FUNCTION__, frmt, ##__VA_ARGS__)
84
+
85
+ #define SYNC_LOG_OBJC_MAYBE(lvl, flg, ctx, frmt, ...) \
86
+ LOG_OBJC_MAYBE( NO, lvl, flg, ctx, frmt, ##__VA_ARGS__)
87
+
88
+ #define ASYNC_LOG_OBJC_MAYBE(lvl, flg, ctx, frmt, ...) \
89
+ LOG_OBJC_MAYBE(YES, lvl, flg, ctx, frmt, ##__VA_ARGS__)
90
+
91
+ #define SYNC_LOG_C_MAYBE(lvl, flg, ctx, frmt, ...) \
92
+ LOG_C_MAYBE( NO, lvl, flg, ctx, frmt, ##__VA_ARGS__)
93
+
94
+ #define ASYNC_LOG_C_MAYBE(lvl, flg, ctx, frmt, ...) \
95
+ LOG_C_MAYBE(YES, lvl, flg, ctx, frmt, ##__VA_ARGS__)
96
+
97
+ /**
98
+ * Define the standard options.
99
+ *
100
+ * We default to only 4 levels because it makes it easier for beginners
101
+ * to make the transition to a logging framework.
102
+ *
103
+ * More advanced users may choose to completely customize the levels (and level names) to suite their needs.
104
+ * For more information on this see the "Custom Log Levels" page:
105
+ * https://github.com/robbiehanson/CocoaLumberjack/wiki/CustomLogLevels
106
+ *
107
+ * Advanced users may also notice that we're using a bitmask.
108
+ * This is to allow for custom fine grained logging:
109
+ * https://github.com/robbiehanson/CocoaLumberjack/wiki/FineGrainedLogging
110
+ *
111
+ * -- Flags --
112
+ *
113
+ * Typically you will use the LOG_LEVELS (see below), but the flags may be used directly in certain situations.
114
+ * For example, say you have a lot of warning log messages, and you wanted to disable them.
115
+ * However, you still needed to see your error and info log messages.
116
+ * You could accomplish that with the following:
117
+ *
118
+ * static const int ddLogLevel = LOG_FLAG_ERROR | LOG_FLAG_INFO;
119
+ *
120
+ * Flags may also be consulted when writing custom log formatters,
121
+ * as the DDLogMessage class captures the individual flag that caused the log message to fire.
122
+ *
123
+ * -- Levels --
124
+ *
125
+ * Log levels are simply the proper bitmask of the flags.
126
+ *
127
+ * -- Booleans --
128
+ *
129
+ * The booleans may be used when your logging code involves more than one line.
130
+ * For example:
131
+ *
132
+ * if (LOG_VERBOSE) {
133
+ * for (id sprocket in sprockets)
134
+ * DDLogVerbose(@"sprocket: %@", [sprocket description])
135
+ * }
136
+ *
137
+ * -- Async --
138
+ *
139
+ * Defines the default asynchronous options.
140
+ * The default philosophy for asynchronous logging is very simple:
141
+ *
142
+ * Log messages with errors should be executed synchronously.
143
+ * After all, an error just occurred. The application could be unstable.
144
+ *
145
+ * All other log messages, such as debug output, are executed asynchronously.
146
+ * After all, if it wasn't an error, then it was just informational output,
147
+ * or something the application was easily able to recover from.
148
+ *
149
+ * -- Changes --
150
+ *
151
+ * You are strongly discouraged from modifying this file.
152
+ * If you do, you make it more difficult on yourself to merge future bug fixes and improvements from the project.
153
+ * Instead, create your own MyLogging.h or ApplicationNameLogging.h or CompanyLogging.h
154
+ *
155
+ * For an example of customizing your logging experience, see the "Custom Log Levels" page:
156
+ * https://github.com/robbiehanson/CocoaLumberjack/wiki/CustomLogLevels
157
+ **/
158
+
159
+ #define LOG_FLAG_ERROR (1 << 0) // 0...0001
160
+ #define LOG_FLAG_WARN (1 << 1) // 0...0010
161
+ #define LOG_FLAG_INFO (1 << 2) // 0...0100
162
+ #define LOG_FLAG_VERBOSE (1 << 3) // 0...1000
163
+
164
+ #define LOG_LEVEL_OFF 0
165
+ #define LOG_LEVEL_ERROR (LOG_FLAG_ERROR) // 0...0001
166
+ #define LOG_LEVEL_WARN (LOG_FLAG_ERROR | LOG_FLAG_WARN) // 0...0011
167
+ #define LOG_LEVEL_INFO (LOG_FLAG_ERROR | LOG_FLAG_WARN | LOG_FLAG_INFO) // 0...0111
168
+ #define LOG_LEVEL_VERBOSE (LOG_FLAG_ERROR | LOG_FLAG_WARN | LOG_FLAG_INFO | LOG_FLAG_VERBOSE) // 0...1111
169
+
170
+ #define LOG_ERROR (ddLogLevel & LOG_FLAG_ERROR)
171
+ #define LOG_WARN (ddLogLevel & LOG_FLAG_WARN)
172
+ #define LOG_INFO (ddLogLevel & LOG_FLAG_INFO)
173
+ #define LOG_VERBOSE (ddLogLevel & LOG_FLAG_VERBOSE)
174
+
175
+ #define LOG_ASYNC_ENABLED YES
176
+
177
+ #define LOG_ASYNC_ERROR ( NO && LOG_ASYNC_ENABLED)
178
+ #define LOG_ASYNC_WARN (YES && LOG_ASYNC_ENABLED)
179
+ #define LOG_ASYNC_INFO (YES && LOG_ASYNC_ENABLED)
180
+ #define LOG_ASYNC_VERBOSE (YES && LOG_ASYNC_ENABLED)
181
+
182
+ #define DDLogError(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_ERROR, ddLogLevel, LOG_FLAG_ERROR, 0, frmt, ##__VA_ARGS__)
183
+ #define DDLogWarn(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_WARN, ddLogLevel, LOG_FLAG_WARN, 0, frmt, ##__VA_ARGS__)
184
+ #define DDLogInfo(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_INFO, ddLogLevel, LOG_FLAG_INFO, 0, frmt, ##__VA_ARGS__)
185
+ #define DDLogVerbose(frmt, ...) LOG_OBJC_MAYBE(LOG_ASYNC_VERBOSE, ddLogLevel, LOG_FLAG_VERBOSE, 0, frmt, ##__VA_ARGS__)
186
+
187
+ #define DDLogCError(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_ERROR, ddLogLevel, LOG_FLAG_ERROR, 0, frmt, ##__VA_ARGS__)
188
+ #define DDLogCWarn(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_WARN, ddLogLevel, LOG_FLAG_WARN, 0, frmt, ##__VA_ARGS__)
189
+ #define DDLogCInfo(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_INFO, ddLogLevel, LOG_FLAG_INFO, 0, frmt, ##__VA_ARGS__)
190
+ #define DDLogCVerbose(frmt, ...) LOG_C_MAYBE(LOG_ASYNC_VERBOSE, ddLogLevel, LOG_FLAG_VERBOSE, 0, frmt, ##__VA_ARGS__)
191
+
192
+ /**
193
+ * The THIS_FILE macro gives you an NSString of the file name.
194
+ * For simplicity and clarity, the file name does not include the full path or file extension.
195
+ *
196
+ * For example: DDLogWarn(@"%@: Unable to find thingy", THIS_FILE) -> @"MyViewController: Unable to find thingy"
197
+ **/
198
+
199
+ NSString *DDExtractFileNameWithoutExtension(const char *filePath, BOOL copy);
200
+
201
+ #define THIS_FILE (DDExtractFileNameWithoutExtension(__FILE__, NO))
202
+
203
+ /**
204
+ * The THIS_METHOD macro gives you the name of the current objective-c method.
205
+ *
206
+ * For example: DDLogWarn(@"%@ - Requires non-nil strings") -> @"setMake:model: requires non-nil strings"
207
+ *
208
+ * Note: This does NOT work in straight C functions (non objective-c).
209
+ * Instead you should use the predefined __FUNCTION__ macro.
210
+ **/
211
+
212
+ #define THIS_METHOD NSStringFromSelector(_cmd)
213
+
214
+
215
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
216
+ #pragma mark -
217
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
218
+
219
+ @interface DDLog : NSObject
220
+
221
+ /**
222
+ * Provides access to the underlying logging queue.
223
+ * This may be helpful to Logger classes for things like thread synchronization.
224
+ **/
225
+
226
+ + (dispatch_queue_t)loggingQueue;
227
+
228
+ /**
229
+ * Logging Primitive.
230
+ *
231
+ * This method is used by the macros above.
232
+ * It is suggested you stick with the macros as they're easier to use.
233
+ **/
234
+
235
+ + (void)log:(BOOL)synchronous
236
+ level:(int)level
237
+ flag:(int)flag
238
+ context:(int)context
239
+ file:(const char *)file
240
+ function:(const char *)function
241
+ line:(int)line
242
+ tag:(id)tag
243
+ format:(NSString *)format, ... __attribute__ ((format (__NSString__, 9, 10)));
244
+
245
+ /**
246
+ * Since logging can be asynchronous, there may be times when you want to flush the logs.
247
+ * The framework invokes this automatically when the application quits.
248
+ **/
249
+
250
+ + (void)flushLog;
251
+
252
+ /**
253
+ * Loggers
254
+ *
255
+ * If you want your log statements to go somewhere,
256
+ * you should create and add a logger.
257
+ **/
258
+
259
+ + (void)addLogger:(id <DDLogger>)logger;
260
+ + (void)removeLogger:(id <DDLogger>)logger;
261
+
262
+ + (void)removeAllLoggers;
263
+
264
+ /**
265
+ * Registered Dynamic Logging
266
+ *
267
+ * These methods allow you to obtain a list of classes that are using registered dynamic logging,
268
+ * and also provides methods to get and set their log level during run time.
269
+ **/
270
+
271
+ + (NSArray *)registeredClasses;
272
+ + (NSArray *)registeredClassNames;
273
+
274
+ + (int)logLevelForClass:(Class)aClass;
275
+ + (int)logLevelForClassWithName:(NSString *)aClassName;
276
+
277
+ + (void)setLogLevel:(int)logLevel forClass:(Class)aClass;
278
+ + (void)setLogLevel:(int)logLevel forClassWithName:(NSString *)aClassName;
279
+
280
+ @end
281
+
282
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
283
+ #pragma mark -
284
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
285
+
286
+ @protocol DDLogger <NSObject>
287
+ @required
288
+
289
+ - (void)logMessage:(DDLogMessage *)logMessage;
290
+
291
+ /**
292
+ * Formatters may optionally be added to any logger.
293
+ * If no formatter is set, the logger simply logs the message as it is given in logMessage.
294
+ * Or it may use its own built in formatting style.
295
+ **/
296
+ - (id <DDLogFormatter>)logFormatter;
297
+ - (void)setLogFormatter:(id <DDLogFormatter>)formatter;
298
+
299
+ @optional
300
+
301
+ /**
302
+ * Since logging is asynchronous, adding and removing loggers is also asynchronous.
303
+ * In other words, the loggers are added and removed at appropriate times with regards to log messages.
304
+ *
305
+ * - Loggers will not receive log messages that were executed prior to when they were added.
306
+ * - Loggers will not receive log messages that were executed after they were removed.
307
+ *
308
+ * These methods are executed in the logging thread/queue.
309
+ * This is the same thread/queue that will execute every logMessage: invocation.
310
+ * Loggers may use these methods for thread synchronization or other setup/teardown tasks.
311
+ **/
312
+ - (void)didAddLogger;
313
+ - (void)willRemoveLogger;
314
+
315
+ /**
316
+ * Some loggers may buffer IO for optimization purposes.
317
+ * For example, a database logger may only save occasionaly as the disk IO is slow.
318
+ * In such loggers, this method should be implemented to flush any pending IO.
319
+ *
320
+ * This allows invocations of DDLog's flushLog method to be propogated to loggers that need it.
321
+ *
322
+ * Note that DDLog's flushLog method is invoked automatically when the application quits,
323
+ * and it may be also invoked manually by the developer prior to application crashes, or other such reasons.
324
+ **/
325
+ - (void)flush;
326
+
327
+ /**
328
+ * Each logger is executed concurrently with respect to the other loggers.
329
+ * Thus, a dedicated dispatch queue is used for each logger.
330
+ * Logger implementations may optionally choose to provide their own dispatch queue.
331
+ **/
332
+ - (dispatch_queue_t)loggerQueue;
333
+
334
+ /**
335
+ * If the logger implementation does not choose to provide its own queue,
336
+ * one will automatically be created for it.
337
+ * The created queue will receive its name from this method.
338
+ * This may be helpful for debugging or profiling reasons.
339
+ **/
340
+ - (NSString *)loggerName;
341
+
342
+ @end
343
+
344
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
345
+ #pragma mark -
346
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
347
+
348
+ @protocol DDLogFormatter <NSObject>
349
+ @required
350
+
351
+ /**
352
+ * Formatters may optionally be added to any logger.
353
+ * This allows for increased flexibility in the logging environment.
354
+ * For example, log messages for log files may be formatted differently than log messages for the console.
355
+ *
356
+ * For more information about formatters, see the "Custom Formatters" page:
357
+ * https://github.com/robbiehanson/CocoaLumberjack/wiki/CustomFormatters
358
+ *
359
+ * The formatter may also optionally filter the log message by returning nil,
360
+ * in which case the logger will not log the message.
361
+ **/
362
+
363
+ - (NSString *)formatLogMessage:(DDLogMessage *)logMessage;
364
+
365
+ @end
366
+
367
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
368
+ #pragma mark -
369
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
370
+
371
+ @protocol DDRegisteredDynamicLogging
372
+
373
+ /**
374
+ * Implement these methods to allow a file's log level to be managed from a central location.
375
+ *
376
+ * This is useful if you'd like to be able to change log levels for various parts
377
+ * of your code from within the running application.
378
+ *
379
+ * Imagine pulling up the settings for your application,
380
+ * and being able to configure the logging level on a per file basis.
381
+ *
382
+ * The implementation can be very straight-forward:
383
+ *
384
+ * + (int)ddLogLevel
385
+ * {
386
+ * return ddLogLevel;
387
+ * }
388
+ *
389
+ * + (void)ddSetLogLevel:(int)logLevel
390
+ * {
391
+ * ddLogLevel = logLevel;
392
+ * }
393
+ **/
394
+
395
+ + (int)ddLogLevel;
396
+ + (void)ddSetLogLevel:(int)logLevel;
397
+
398
+ @end
399
+
400
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
401
+ #pragma mark -
402
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
403
+
404
+ /**
405
+ * The DDLogMessage class encapsulates information about the log message.
406
+ * If you write custom loggers or formatters, you will be dealing with objects of this class.
407
+ **/
408
+
409
+ @interface DDLogMessage : NSObject
410
+ {
411
+
412
+ // The public variables below can be accessed directly (for speed).
413
+ // For example: logMessage->logLevel
414
+
415
+ @public
416
+ int logLevel;
417
+ int logFlag;
418
+ int logContext;
419
+ NSString *logMsg;
420
+ NSDate *timestamp;
421
+ const char *file;
422
+ const char *function;
423
+ int lineNumber;
424
+ mach_port_t machThreadID;
425
+ char *queueLabel;
426
+ NSString *threadName;
427
+ id tag; // For 3rd party extensions to the framework, where flags and contexts aren't enough.
428
+ }
429
+
430
+ /**
431
+ * The initializer is somewhat reserved for internal use.
432
+ * However, if you find need to manually create logMessage objects, there is one thing you should be aware of:
433
+ *
434
+ * The initializer expects the file and function parameters to be string literals.
435
+ * That is, it expects the given strings to exist for the duration of the object's lifetime,
436
+ * and it expects the given strings to be immutable.
437
+ * In other words, it does not copy these strings, it simply points to them.
438
+ **/
439
+ - (id)initWithLogMsg:(NSString *)logMsg
440
+ level:(int)logLevel
441
+ flag:(int)logFlag
442
+ context:(int)logContext
443
+ file:(const char *)file
444
+ function:(const char *)function
445
+ line:(int)line
446
+ tag:(id)tag;
447
+
448
+ /**
449
+ * Returns the threadID as it appears in NSLog.
450
+ * That is, it is a hexadecimal value which is calculated from the machThreadID.
451
+ **/
452
+ - (NSString *)threadID;
453
+
454
+ /**
455
+ * Convenience property to get just the file name, as the file variable is generally the full file path.
456
+ * This method does not include the file extension, which is generally unwanted for logging purposes.
457
+ **/
458
+ - (NSString *)fileName;
459
+
460
+ /**
461
+ * Returns the function variable in NSString form.
462
+ **/
463
+ - (NSString *)methodName;
464
+
465
+ @end
466
+
467
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
468
+ #pragma mark -
469
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
470
+
471
+ /**
472
+ * The DDLogger protocol specifies that an optional formatter can be added to a logger.
473
+ * Most (but not all) loggers will want to support formatters.
474
+ *
475
+ * However, writting getters and setters in a thread safe manner,
476
+ * while still maintaining maximum speed for the logging process, is a difficult task.
477
+ *
478
+ * To do it right, the implementation of the getter/setter has strict requiremenets:
479
+ * - Must NOT require the logMessage method to acquire a lock.
480
+ * - Must NOT require the logMessage method to access an atomic property (also a lock of sorts).
481
+ *
482
+ * To simplify things, an abstract logger is provided that implements the getter and setter.
483
+ *
484
+ * Logger implementations may simply extend this class,
485
+ * and they can ACCESS THE FORMATTER VARIABLE DIRECTLY from within their logMessage method!
486
+ **/
487
+
488
+ @interface DDAbstractLogger : NSObject <DDLogger>
489
+ {
490
+ id <DDLogFormatter> formatter;
491
+
492
+ dispatch_queue_t loggerQueue;
493
+ }
494
+
495
+ - (id <DDLogFormatter>)logFormatter;
496
+ - (void)setLogFormatter:(id <DDLogFormatter>)formatter;
497
+
498
+ @end