![]() |
IOS Streaming Browser 1.0
An IOS streaming browser to stream the display to others or to a projector
|
#import <DDLog.h>
Static Public Member Functions | |
(NSThread *) | + loggingThread |
(void) | + log:level:flag:context:file:function:line:format: |
(void) | + flushLog |
(void) | + addLogger: |
(void) | + removeLogger: |
(void) | + removeAllLoggers |
(NSArray *) | + registeredClasses |
(NSArray *) | + registeredClassNames |
(int) | + logLevelForClass: |
(int) | + logLevelForClassWithName: |
(void) | + setLogLevel:forClass: |
(void) | + setLogLevel:forClassWithName: |
(void) | + lt_addLogger: |
(void) | + lt_removeLogger: |
(void) | + lt_removeAllLoggers |
(void) | + lt_log: |
(void) | + lt_flush |
+ (void) addLogger: | (id <DDLogger>) | logger |
Loggers
If you want your log statements to go somewhere, you should create and add a logger.
Class method
Definition at line 262 of file DDLog.m.
:(id <DDLogger>)logger { if (logger == nil) return; if (IS_GCD_AVAILABLE) { #if GCD_MAYBE_AVAILABLE dispatch_block_t addLoggerBlock = ^{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [self lt_addLogger:logger]; [pool release]; }; dispatch_async(loggingQueue, addLoggerBlock); #endif } else { #if GCD_MAYBE_UNAVAILABLE [self performSelector:@selector(lt_addLogger:) onThread:loggingThread withObject:logger waitUntilDone:NO]; #endif } }
+ (void) flushLog |
Since logging can be asynchronous, there may be times when you want to flush the logs. The framework invokes this automatically when the application quits.
Class method
Definition at line 567 of file DDLog.m.
{ if (IS_GCD_AVAILABLE) { #if GCD_MAYBE_AVAILABLE dispatch_block_t flushBlock = ^{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [self lt_flush]; [pool release]; }; dispatch_sync(loggingQueue, flushBlock); #endif } else { #if GCD_MAYBE_UNAVAILABLE [self performSelector:@selector(lt_flush) onThread:loggingThread withObject:nil waitUntilDone:YES]; #endif } }
+ (void) log: | (BOOL) | synchronous | |
level: | (int) | level | |
flag: | (int) | flag | |
context: | (int) | context | |
file: | (const char *) | file | |
function: | (const char *) | function | |
line: | (int) | line | |
format: | (NSString *) | format | |
, | ... | ||
Logging Primitive.
This method is used by the macros above. It is suggested you stick with the macros as they're easier to use.
Class method param BOOL param int param in param int param const char param const char param int param NSString
Definition at line 531 of file DDLog.m.
:(BOOL)synchronous level:(int)level flag:(int)flag context:(int)context file:(const char *)file function:(const char *)function line:(int)line format:(NSString *)format, ... { va_list args; if (format) { va_start(args, format); NSString *logMsg = [[NSString alloc] initWithFormat:format arguments:args]; DDLogMessage *logMessage = [[DDLogMessage alloc] initWithLogMsg:logMsg level:level flag:flag context:context file:file function:function line:line]; [self queueLogMessage:logMessage synchronously:synchronous]; [logMessage release]; [logMsg release]; va_end(args); } }
+ (NSThread *) loggingThread |
Provides access to the underlying logging thread. This may be helpful to Logger classes for things like thread synchronization.
Provides access to the logging thread.
Definition at line 236 of file DDLog.m.
{ return loggingThread; }
+ (int) logLevelForClass: | (Class) | aClass |
+ (int) logLevelForClassWithName: | (NSString *) | aClassName |
+ (void) lt_addLogger: | (id< DDLogger >) | logger |
Class method param id <DDLogger>
+ (void) lt_flush |
Class method
+ (void) lt_log: | (DDLogMessage *) | logMessage |
Class method param DDLogMessage
+ (void) lt_removeAllLoggers |
Class method
+ (void) lt_removeLogger: | (id< DDLogger >) | logger |
Class method param id <DDLogger>
+ (NSArray *) registeredClasses |
Registered Dynamic Logging
These methods allow you to obtain a list of classes that are using registered dynamic logging, and also provides methods to get and set their log level during run time. Class method
Class method returns NSArray
Definition at line 624 of file DDLog.m.
{ int numClasses, i; // We're going to get the list of all registered classes. // The Objective-C runtime library automatically registers all the classes defined in your source code. // // To do this we use the following method (documented in the Objective-C Runtime Reference): // // int objc_getClassList(Class *buffer, int bufferLen) // // We can pass (NULL, 0) to obtain the total number of // registered class definitions without actually retrieving any class definitions. // This allows us to allocate the minimum amount of memory needed for the application. numClasses = objc_getClassList(NULL, 0); // The numClasses method now tells us how many classes we have. // So we can allocate our buffer, and get pointers to all the class definitions. Class *classes = malloc(sizeof(Class) * numClasses); numClasses = objc_getClassList(classes, numClasses); // We can now loop through the classes, and test each one to see if it is a DDLogging class. NSMutableArray *result = [NSMutableArray arrayWithCapacity:numClasses]; for (i = 0; i < numClasses; i++) { Class class = classes[i]; if ([self isRegisteredClass:class]) { [result addObject:class]; } } free(classes); return result; }
+ (NSArray *) registeredClassNames |
Class method returns NSArray
Definition at line 672 of file DDLog.m.
{ NSArray *registeredClasses = [self registeredClasses]; NSMutableArray *result = [NSMutableArray arrayWithCapacity:[registeredClasses count]]; for (Class class in registeredClasses) { [result addObject:NSStringFromClass(class)]; } return result; }
+ (void) removeAllLoggers |
Class method
Definition at line 328 of file DDLog.m.
{ if (IS_GCD_AVAILABLE) { #if GCD_MAYBE_AVAILABLE dispatch_block_t removeAllLoggersBlock = ^{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [self lt_removeAllLoggers]; [pool release]; }; dispatch_async(loggingQueue, removeAllLoggersBlock); #endif } else { #if GCD_MAYBE_UNAVAILABLE [self performSelector:@selector(lt_removeAllLoggers) onThread:loggingThread withObject:nil waitUntilDone:NO]; #endif } }
+ (void) removeLogger: | (id <DDLogger>) | logger |
Class method
Definition at line 295 of file DDLog.m.
:(id <DDLogger>)logger { if (logger == nil) return; if (IS_GCD_AVAILABLE) { #if GCD_MAYBE_AVAILABLE dispatch_block_t removeLoggerBlock = ^{ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [self lt_removeLogger:logger]; [pool release]; }; dispatch_async(loggingQueue, removeLoggerBlock); #endif } else { #if GCD_MAYBE_UNAVAILABLE [self performSelector:@selector(lt_removeLogger:) onThread:loggingThread withObject:logger waitUntilDone:NO]; #endif } }
+ (void) setLogLevel: | (int) | logLevel | |
forClass: | (Class) | aClass | |
+ (void) setLogLevel: | (int) | logLevel | |
forClassWithName: | (NSString *) | aClassName | |