diff options
author | rowanbeentje <rowan@beent.je> | 2010-12-19 20:36:33 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2010-12-19 20:36:33 +0000 |
commit | ea006519632c5c78bc9af5e87d7f5c60edd17081 (patch) | |
tree | 6b7c2707a41b0ca69bb7a9bd86070a98effd853c /Source/SPLogger.m | |
parent | 8ad3b1a34828fd624ceaa4a238fdf84fdf8536cb (diff) | |
download | sequelpro-ea006519632c5c78bc9af5e87d7f5c60edd17081.tar.gz sequelpro-ea006519632c5c78bc9af5e87d7f5c60edd17081.tar.bz2 sequelpro-ea006519632c5c78bc9af5e87d7f5c60edd17081.zip |
- Improve SPLogger to fix log issues when using SPLogger from multiple exectuables or frameworks during debug - each of which starts their own instance.
Diffstat (limited to 'Source/SPLogger.m')
-rw-r--r-- | Source/SPLogger.m | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/SPLogger.m b/Source/SPLogger.m index 743b0fce..5736fde6 100644 --- a/Source/SPLogger.m +++ b/Source/SPLogger.m @@ -107,7 +107,10 @@ static SPLogger *logger = nil; NSString *logString = [[NSString alloc] initWithFormat:theString arguments:arguments]; va_end(arguments); - // Write the log line, forcing an immediate write to disk to ensure logging + // Write the log line, forcing an immediate write to disk to ensure logging, and + // synchronised to allow use across multiple executables or their frameworks. + [logFileHandle synchronizeFile]; + [logFileHandle seekToEndOfFile]; [logFileHandle writeData:[[NSString stringWithFormat:@"%@ %@\n", [[NSDate date] descriptionWithCalendarFormat:@"%H:%M:%S" timeZone:nil locale:[[NSUserDefaults standardUserDefaults] dictionaryRepresentation]], logString] dataUsingEncoding:NSUTF8StringEncoding]]; [logFileHandle synchronizeFile]; |