diff options
author | stuconnolly <stuart02@gmail.com> | 2010-04-24 22:20:04 +0000 |
---|---|---|
committer | stuconnolly <stuart02@gmail.com> | 2010-04-24 22:20:04 +0000 |
commit | d04a1612e5c26e2752d6c30c5aaf5289d01e90a9 (patch) | |
tree | 4b71bfb5f0045282982f280bea0cd1b2684b0cf0 /Source/SPLogger.h | |
parent | 452e5fb8e8fd1f22be98b26ece0010af09fb3d7d (diff) | |
download | sequelpro-d04a1612e5c26e2752d6c30c5aaf5289d01e90a9.tar.gz sequelpro-d04a1612e5c26e2752d6c30c5aaf5289d01e90a9.tar.bz2 sequelpro-d04a1612e5c26e2752d6c30c5aaf5289d01e90a9.zip |
Enhance SPLogger by adding the ability to run leaks() against the application upon termination with the result being written to /tmp.
To enable call setDumpLeaksOnTermination on SPLogger.
Note, that SPLogger has been restructed to accommodate calling this method without writing the additional log file to the user's desktop. Could probably be enhanced a bit by someone with better C skills than me.
Diffstat (limited to 'Source/SPLogger.h')
-rw-r--r-- | Source/SPLogger.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/Source/SPLogger.h b/Source/SPLogger.h index ac9b9a04..09fbfd53 100644 --- a/Source/SPLogger.h +++ b/Source/SPLogger.h @@ -27,13 +27,50 @@ @interface SPLogger : NSObject { + /** + * Dump leaks on termination flag. + */ + BOOL dumpLeaksOnTermination; + + /** + * Log file initialized successfully flag. + */ BOOL initializedSuccessfully; + + /** + * Log file handle. + */ NSFileHandle *logFileHandle; } +/** + * Returns the shared logger. + * + * @return The logger instance + */ + (SPLogger *)logger; -- (void) outputTimeString; -- (void) log:(NSString *)theString, ...; +/** + * Tells the logger to dump leaks analysis upon app termination. + */ +- (void)setDumpLeaksOnTermination; + +/** + * Dumps the result of running leaks to the file '/tmp/sp.leaks.<pid>.tmp'. + * + * Note, that to enable useful output, make sure the following environment variables are set to YES: + * + * MallocStackLogging + * MallocStackLoggingNoCompact + * + * Also note that the application may take a while to terminate if it has been running for a significant + * period of time or has been handling large amounts of data. + */ +- (void)dumpLeaks; + +/** + * Logs the supplied string to the log file. + */ +- (void)log:(NSString *)theString, ...; @end |