From dfbdc838df65dcfc8e743dffbc785f4703703d9a Mon Sep 17 00:00:00 2001 From: CaS Date: Fri, 11 Oct 2002 09:14:14 +0000 Subject: [PATCH] Added GSPrintf() git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14714 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 10 +++ Headers/gnustep/base/NSObjCRuntime.h | 5 +- Source/NSDate.m | 114 +++++++++++++++++++-------- Source/NSLog.m | 70 +++++++++++++++- Testing/nsdate.m | 3 + Tools/defaults.m | 31 ++++---- Tools/pl2link.m | 17 ++-- Tools/pldes.m | 7 +- Tools/plmerge.m | 19 +++-- Tools/plparse.m | 19 ++--- Tools/plser.m | 7 +- Tools/sfparse.m | 31 +++++--- 12 files changed, 241 insertions(+), 92 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f723990b..7e6cf902e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-10-10 Richard Frith-Macdonald + + * Source/NSLog.m: Added GSPrintf() + * Tools/defaults.m: Use GSPrintf() + * Tools/pldes.m: ditto + * Tools/plser.m: ditto + * Tools/plmerge.m: ditto + * Tools/plparse.m: ditto + * Tools/sfparse.m: ditto + 2002-10-09 Richard Frith-Macdonald * Tools/GNUmakefile: revert ... can't build if base library isn't diff --git a/Headers/gnustep/base/NSObjCRuntime.h b/Headers/gnustep/base/NSObjCRuntime.h index 0742ca3c3..665ecb396 100644 --- a/Headers/gnustep/base/NSObjCRuntime.h +++ b/Headers/gnustep/base/NSObjCRuntime.h @@ -69,10 +69,11 @@ GS_EXPORT NSLog_printf_handler *_NSLog_printf_handler; GS_EXPORT int _NSLogDescriptor; @class NSRecursiveLock; GS_EXPORT NSRecursiveLock *GSLogLock(); +GS_EXPORT BOOL GSPrintf (FILE *fptr, NSString *format, ...); #endif -GS_EXPORT void NSLog (NSString* format, ...); -GS_EXPORT void NSLogv (NSString* format, va_list args); +GS_EXPORT void NSLog (NSString *format, ...); +GS_EXPORT void NSLogv (NSString *format, va_list args); #ifndef YES #define YES 1 diff --git a/Source/NSDate.m b/Source/NSDate.m index c7da8bd49..02f3f6c42 100644 --- a/Source/NSDate.m +++ b/Source/NSDate.m @@ -256,8 +256,9 @@ GSTimeNow() unsigned dtoIndex; if (locale == nil) - locale = GSUserDefaultsDictionaryRepresentation(); - + { + locale = GSUserDefaultsDictionaryRepresentation(); + } ws = [NSCharacterSet whitespaceAndNewlineCharacterSet]; digits = [NSCharacterSet decimalDigitCharacterSet]; scanner = [NSScanner scannerWithString: string]; @@ -521,14 +522,18 @@ GSTimeNow() if (dto == nil) { if (debug) - NSLog(@"no NSDateTimeOrdering - default to DMYH.\n"); + { + NSLog(@"no NSDateTimeOrdering - default to DMYH."); + } dto = @"DMYH"; } length = [dto length]; if (length > 4) { if (debug) - NSLog(@"too many characters in NSDateTimeOrdering - truncating.\n"); + { + NSLog(@"too many characters in NSDateTimeOrdering - truncating."); + } length = 4; } @@ -557,9 +562,13 @@ GSTimeNow() if (num > 23) { if (debug) - NSLog(@"hour (%d) too large - ignored.\n", num); + { + NSLog(@"hour (%d) too large - ignored.", num); + } else - return nil; + { + return nil; + } } else { @@ -574,9 +583,13 @@ GSTimeNow() if (num > 59) { if (debug) - NSLog(@"minute (%d) too large - ignored.\n", num); + { + NSLog(@"minute (%d) too large - ignored.", num); + } else - return nil; + { + return nil; + } } else { @@ -590,9 +603,13 @@ GSTimeNow() if (num > 59) { if (debug) - NSLog(@"second (%d) too large - ignored.\n", num); + { + NSLog(@"second (%d) too large - ignored.", num); + } else - return nil; + { + return nil; + } } else { @@ -603,7 +620,9 @@ GSTimeNow() else { if (debug) - NSLog(@"odd time spec - excess numbers ignored.\n"); + { + NSLog(@"odd time spec - excess numbers ignored."); + } } done = YES; @@ -661,8 +680,10 @@ GSTimeNow() default: if (debug) - NSLog(@"odd char (unicode %d) in NSDateTimeOrdering.\n", - [dto characterAtIndex: dtoIndex]); + { + NSLog(@"odd char (unicode %d) in NSDateTimeOrdering.", + [dto characterAtIndex: dtoIndex]); + } dtoIndex++; break; } @@ -670,7 +691,9 @@ GSTimeNow() if (dtoIndex >= [dto length]) { if (debug) - NSLog(@"odd date specification - excess numbers ignored.\n"); + { + NSLog(@"odd date specification - excess numbers ignored."); + } break; } switch ([dto characterAtIndex: dtoIndex]) @@ -679,16 +702,24 @@ GSTimeNow() if (num < 1) { if (debug) - NSLog(@"day (0) too small - ignored.\n"); + { + NSLog(@"day (0) too small - ignored."); + } else - return nil; + { + return nil; + } } else if (num > 31) { if (debug) - NSLog(@"day (%d) too large - ignored.\n", num); + { + NSLog(@"day (%d) too large - ignored.", num); + } else - return nil; + { + return nil; + } } else { @@ -700,16 +731,24 @@ GSTimeNow() if (num < 1) { if (debug) - NSLog(@"month (0) too small - ignored.\n"); + { + NSLog(@"month (0) too small - ignored."); + } else - return nil; + { + return nil; + } } else if (num > 12) { if (debug) - NSLog(@"month (%d) too large - ignored.\n", num); + { + NSLog(@"month (%d) too large - ignored.", num); + } else - return nil; + { + return nil; + } } else { @@ -729,7 +768,9 @@ GSTimeNow() Y = num + 1900; } if (debug) - NSLog(@"year (%d) adjusted to %d.\n", num, Y); + { + NSLog(@"year (%d) adjusted to %d.", num, Y); + } } else { @@ -757,10 +798,13 @@ GSTimeNow() if (num > 11) { if (debug) - NSLog(@"hour (%d) too large - ignored.\n", - num); + { + NSLog(@"hour (%d) too large - ignored.", num); + } else - return nil; + { + return nil; + } shouldIgnore = YES; } else if (mod == [ampm objectAtIndex: 1]) @@ -774,9 +818,13 @@ GSTimeNow() if (num > 23) { if (debug) - NSLog(@"hour (%d) too large - ignored.\n", num); + { + NSLog(@"hour (%d) too large - ignored.", num); + } else - return nil; + { + return nil; + } } else { @@ -788,8 +836,10 @@ GSTimeNow() } default: if (debug) - NSLog(@"unexpected char (unicode%d) in NSDateTimeOrdering.\n", - [dto characterAtIndex: dtoIndex]); + { + NSLog(@"unexpected char (unicode%d) in NSDateTimeOrdering.", + [dto characterAtIndex: dtoIndex]); + } break; } } @@ -843,7 +893,9 @@ GSTimeNow() if (hadWeekDay && [theDate dayOfWeek] != weekDay) { if (debug) - NSLog(@"Date resulted in wrong day of week.\n"); + { + NSLog(@"Date resulted in wrong day of week."); + } return nil; } if (theDate == nil) diff --git a/Source/NSLog.m b/Source/NSLog.m index e8d8691be..f6d873f97 100644 --- a/Source/NSLog.m +++ b/Source/NSLog.m @@ -20,7 +20,7 @@ License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. - NSLog class reference + NSLog reference $Date$ $Revision$ */ @@ -182,7 +182,15 @@ _NSLog_standard_printf_handler (NSString* message) NSLog_printf_handler *_NSLog_printf_handler = _NSLog_standard_printf_handler; /** - * Provides a standard logging facility via NSLogv(). + *

Provides the standard OpenStep logging facility. For details see + * the lower level NSLogv() function (which this function uses). + *

+ *

GNUstep provides powerful alternatives for logging ... see + * NSDebugLog(), NSWarnLog(), and GSPrintf() for example. We recommend + * the use of NSDebugLog() and its relatives for debug purposes, and + * GSPrintf() for general log messages, with NSLog() being reserved + * for reporting possible/likely errors. + *

*/ void NSLog (NSString* format, ...) @@ -264,3 +272,61 @@ NSLogv (NSString* format, va_list args) RELEASE(arp); } +/** + *

Prints a message to fptr using the format string provided and any + * additional arguments. The format string is interpreted as by + * the NSString formatted initialisers, and understands the '%@' syntax + * for printing an object. + *

+ *

The data is written to the file pointer in the default CString + * encoding if possible, as a UTF8 string otherwise. + *

+ *

This function is recommended for printing general log messages. + * For debug messages use NSDebugLog() and friends. For error logging + * use NSLog(), and for warnings you might consider NSWarnLog(). + */ +BOOL +GSPrintf (FILE *fptr, NSString* format, ...) +{ + static Class stringClass = 0; + static NSStringEncoding enc; + CREATE_AUTORELEASE_POOL(arp); + va_list ap; + NSString *message; + NSData *data; + BOOL ok = NO; + + if (stringClass == 0) + { + [gnustep_global_lock lock]; + if (stringClass == 0) + { + stringClass = [NSString class]; + enc = [stringClass defaultCStringEncoding]; + } + [gnustep_global_lock unlock]; + } + message = [stringClass allocWithZone: NSDefaultMallocZone()]; + va_start (ap, format); + message = [message initWithFormat: format locale: nil arguments: ap]; + va_end (ap); + data = [message dataUsingEncoding: enc]; + if (data == nil) + { + data = [message dataUsingEncoding: NSUTF8StringEncoding]; + } + RELEASE(message); + + if (data != nil) + { + unsigned int length = [data length]; + + if (length == 0 || fwrite([data bytes], 1, length, fptr) == length) + { + ok = YES; + } + } + RELEASE(arp); + return ok; +} + diff --git a/Testing/nsdate.m b/Testing/nsdate.m index 340a062fe..9df212eab 100644 --- a/Testing/nsdate.m +++ b/Testing/nsdate.m @@ -25,6 +25,9 @@ main() pool = [[NSAutoreleasePool alloc] init]; + NSLog(@"%@", [NSCalendarDate dateWithNaturalLanguageString: @"01-08-2002 00:00:00"]); + NSLog(@"%@", [NSCalendarDate dateWithNaturalLanguageString: @"31-08-2002 23:59:59"]); + if ([(NSDate*) [NSCalendarDate date] compare: [NSCalendarDate dateWithString:@"Feb 2 00:00:00 2001" calendarFormat:@"%b %d %H:%M:%S %Y"]] == NSOrderedDescending) { diff --git a/Tools/defaults.m b/Tools/defaults.m index 043276318..652386146 100644 --- a/Tools/defaults.m +++ b/Tools/defaults.m @@ -55,7 +55,7 @@ main(int argc, char** argv, char **env) proc = [NSProcessInfo processInfo]; if (proc == nil) { - NSLog(@"defaults: unable to get process information!\n"); + GSPrintf(stderr, @"defaults: unable to get process information!\n"); [pool release]; exit(0); } @@ -178,7 +178,7 @@ main(int argc, char** argv, char **env) i = 1; if ([args count] <= i) { - NSLog(@"defaults: too few arguments supplied!\n"); + GSPrintf(stderr, @"defaults: too few arguments supplied!\n"); [pool release]; exit(0); } @@ -190,7 +190,7 @@ main(int argc, char** argv, char **env) } else { - NSLog(@"defaults: no name supplied for -u option!\n"); + GSPrintf(stderr, @"defaults: no name supplied for -u option!\n"); [pool release]; exit(0); } @@ -206,7 +206,7 @@ main(int argc, char** argv, char **env) } if (defs == nil) { - NSLog(@"defaults: unable to access defaults database!\n"); + GSPrintf(stderr, @"defaults: unable to access defaults database!\n"); [pool release]; exit(0); } @@ -215,7 +215,7 @@ main(int argc, char** argv, char **env) if ([args count] <= i) { - NSLog(@"defaults: too few arguments supplied!\n"); + GSPrintf(stderr, @"defaults: too few arguments supplied!\n"); [pool release]; exit(0); } @@ -245,7 +245,7 @@ main(int argc, char** argv, char **env) { if ([args count] == ++i) { - NSLog(@"defaults: too few arguments supplied!\n"); + GSPrintf(stderr, @"defaults: too few arguments supplied!\n"); [pool release]; exit(0); } @@ -528,7 +528,7 @@ main(int argc, char** argv, char **env) owner = [args objectAtIndex: i++]; if ([args count] <= i) { - NSLog(@"defaults: no dictionary or key for write!\n"); + GSPrintf(stderr, @"defaults: no dictionary or key for write!\n"); [pool release]; exit(0); } @@ -571,7 +571,8 @@ main(int argc, char** argv, char **env) if (domain == nil || [domain isKindOfClass: [NSDictionary class]] == NO) { - NSLog(@"defaults write: domain is not a dictionary!\n"); + GSPrintf(stderr, + @"defaults write: domain is not a dictionary!\n"); [pool release]; exit(0); } @@ -580,8 +581,9 @@ main(int argc, char** argv, char **env) if ([defs synchronize] == NO) { - NSLog(@"defaults: unable to write to defaults database - %s\n", - strerror(errno)); + GSPrintf(stderr, + @"defaults: unable to write to defaults database - %s\n", + strerror(errno)); } } else if ([[args objectAtIndex: i] isEqual: @"delete"]) @@ -682,8 +684,9 @@ main(int argc, char** argv, char **env) } if ([defs synchronize] == NO) { - NSLog(@"defaults: unable to write to defaults database - %s\n", - strerror(errno)); + GSPrintf(stderr, + @"defaults: unable to write to defaults database - %s\n", + strerror(errno)); } } else if ([[args objectAtIndex: i] isEqual: @"domains"]) @@ -700,7 +703,7 @@ main(int argc, char** argv, char **env) { if ([args count] == ++i) { - NSLog(@"defaults: no arguments for find!\n"); + GSPrintf(stderr, @"defaults: no arguments for find!\n"); [pool release]; exit(0); } @@ -756,7 +759,7 @@ main(int argc, char** argv, char **env) } else { - NSLog(@"defaults: unknown option supplied!\n"); + GSPrintf(stderr, @"defaults: unknown option supplied!\n"); } [pool release]; diff --git a/Tools/pl2link.m b/Tools/pl2link.m index f77fb7824..5804ee942 100644 --- a/Tools/pl2link.m +++ b/Tools/pl2link.m @@ -59,8 +59,8 @@ main(int argc, char** argv, char **env) if ([args count] < 2) { - NSLog(@"Usage: %@ input-file [destination-file]", - [procinfo processName]); + GSPrintf(stderr, @"Usage: %@ input-file [destination-file]\n", + [procinfo processName]); [pool release]; exit(0); } @@ -82,13 +82,15 @@ main(int argc, char** argv, char **env) } NS_HANDLER { - NSLog(@"Parsing '%@' - %@", sourceName, [localException reason]); + GSPrintf(stderr, @"Parsing '%@' - %@\n", sourceName, + [localException reason]); } NS_ENDHANDLER if ((plist == nil) || ![plist isKindOfClass: [NSDictionary class]]) { - NSLog(@"The source property list must contain an NSDictionary."); + GSPrintf(stderr, + @"The source property list must contain an NSDictionary.\n"); [pool release]; exit(1); } @@ -146,9 +148,10 @@ main(int argc, char** argv, char **env) } if ([[fileContents dataUsingEncoding: NSUTF8StringEncoding] - writeToFile: destName atomically: YES] == NO) - NSLog(@"Error writing property list to '%@'", destName); - + writeToFile: destName atomically: YES] == NO) + { + GSPrintf(stderr, @"Error writing property list to '%@'\n", destName); + } [pool release]; exit(0); } diff --git a/Tools/pldes.m b/Tools/pldes.m index 04862df16..2895930cf 100644 --- a/Tools/pldes.m +++ b/Tools/pldes.m @@ -55,7 +55,7 @@ main(int argc, char** argv, char **env) if ([args count] <= 1) { - NSLog(@"No file names given to deserialize."); + GSPrintf(stderr, @"No file names given to deserialize.\n"); } else { @@ -76,7 +76,7 @@ main(int argc, char** argv, char **env) result = [NSDeserializer deserializePropertyListFromData: myData mutableContainers: NO]; if (result == nil) - NSLog(@"Loading '%@' - nil property list", file); + GSPrintf(stderr, @"Loading '%@' - nil property list\n", file); else { NSFileHandle *out; @@ -90,7 +90,8 @@ main(int argc, char** argv, char **env) } NS_HANDLER { - NSLog(@"Loading '%@' - %@", file, [localException reason]); + GSPrintf(stderr, @"Loading '%@' - %@\n", file, + [localException reason]); } NS_ENDHANDLER } diff --git a/Tools/plmerge.m b/Tools/plmerge.m index f81f2c251..f6aad5eca 100644 --- a/Tools/plmerge.m +++ b/Tools/plmerge.m @@ -55,8 +55,8 @@ main(int argc, char** argv, char **env) if ([args count] < 3) { - NSLog(@"Usage: %@ [destination-file] [input-file ...]", - [procinfo processName]); + GSPrintf(stderr, @"Usage: %@ [destination-file] [input-file ...]\n", + [procinfo processName]); [pool release]; exit(0); } @@ -71,13 +71,15 @@ main(int argc, char** argv, char **env) } NS_HANDLER { - NSLog(@"Parsing '%@' - %@", destName, [localException reason]); + GSPrintf(stderr, @"Parsing '%@' - %@\n", destName, + [localException reason]); } NS_ENDHANDLER if ((plist == nil) || ![plist isKindOfClass: [NSDictionary class]]) { - NSLog(@"The destination property list must contain an NSDictionary."); + GSPrintf(stderr, + @"The destination property list must contain an NSDictionary.\n"); [pool release]; exit(1); } @@ -100,7 +102,8 @@ main(int argc, char** argv, char **env) } NS_HANDLER { - NSLog(@"Parsing '%@' - %@", filename, [localException reason]); + GSPrintf(stderr, @"Parsing '%@' - %@\n", filename, + [localException reason]); } NS_ENDHANDLER @@ -110,7 +113,7 @@ main(int argc, char** argv, char **env) } if (object == nil) - NSLog(@"Parsing '%@' - nil property list", filename); + GSPrintf(stderr, @"Parsing '%@' - nil property list\n", filename); else if ([object isKindOfClass: [NSArray class]] == YES) [plist setObject: object forKey: key]; else if ([object isKindOfClass: [NSData class]] == YES) @@ -120,12 +123,12 @@ main(int argc, char** argv, char **env) else if ([object isKindOfClass: [NSString class]] == YES) [plist setObject: object forKey: key]; else - NSLog(@"Parsing '%@' - unexpected class - %@", + GSPrintf(stderr, @"Parsing '%@' - unexpected class - %@\n", filename, [[object class] description]); } if ([plist writeToFile: destName atomically: YES] == NO) - NSLog(@"Error writing property list to '%@'", destName); + GSPrintf(stderr, @"Error writing property list to '%@'\n", destName); [pool release]; exit(0); diff --git a/Tools/plparse.m b/Tools/plparse.m index a5584b0ac..d856bcefe 100644 --- a/Tools/plparse.m +++ b/Tools/plparse.m @@ -53,7 +53,7 @@ main(int argc, char** argv, char **env) if ([args count] <= 1) { - NSLog(@"No file names given to parse."); + GSPrintf(stderr, @"No file names given to parse.\n"); } else { @@ -69,22 +69,23 @@ main(int argc, char** argv, char **env) myString = [NSString stringWithContentsOfFile: file]; result = [myString propertyList]; if (result == nil) - NSLog(@"Parsing '%@' - nil property list", file); + GSPrintf(stderr, @"Parsing '%@' - nil property list\n", file); else if ([result isKindOfClass: [NSDictionary class]] == YES) - NSLog(@"Parsing '%@' - a dictionary", file); + GSPrintf(stderr, @"Parsing '%@' - a dictionary\n", file); else if ([result isKindOfClass: [NSArray class]] == YES) - NSLog(@"Parsing '%@' - an array", file); + GSPrintf(stderr, @"Parsing '%@' - an array\n", file); else if ([result isKindOfClass: [NSData class]] == YES) - NSLog(@"Parsing '%@' - a data object", file); + GSPrintf(stderr, @"Parsing '%@' - a data object\n", file); else if ([result isKindOfClass: [NSString class]] == YES) - NSLog(@"Parsing '%@' - a string", file); + GSPrintf(stderr, @"Parsing '%@' - a string\n", file); else - NSLog(@"Parsing '%@' - unexpected class - %@", - file, [[result class] description]); + GSPrintf(stderr, @"Parsing '%@' - unexpected class - %@\n", + file, [[result class] description]); } NS_HANDLER { - NSLog(@"Parsing '%@' - %@", file, [localException reason]); + GSPrintf(stderr, @"Parsing '%@' - %@\n", file, + [localException reason]); } NS_ENDHANDLER } diff --git a/Tools/plser.m b/Tools/plser.m index 11b6dfe9e..b481ad2b8 100644 --- a/Tools/plser.m +++ b/Tools/plser.m @@ -55,7 +55,7 @@ main(int argc, char** argv, char **env) if ([args count] <= 1) { - NSLog(@"No file names given to serialize."); + GSPrintf(stderr, @"No file names given to serialize.\n"); } else { @@ -72,7 +72,7 @@ main(int argc, char** argv, char **env) myString = [NSString stringWithContentsOfFile: file]; result = [myString propertyList]; if (result == nil) - NSLog(@"Loading '%@' - nil property list", file); + GSPrintf(stderr, @"Loading '%@' - nil property list\n", file); else { NSFileHandle *out; @@ -85,7 +85,8 @@ main(int argc, char** argv, char **env) } NS_HANDLER { - NSLog(@"Loading '%@' - %@", file, [localException reason]); + GSPrintf(stderr, @"Loading '%@' - %@\n", file, + [localException reason]); } NS_ENDHANDLER } diff --git a/Tools/sfparse.m b/Tools/sfparse.m index abc6ba0fa..381d4976f 100644 --- a/Tools/sfparse.m +++ b/Tools/sfparse.m @@ -45,19 +45,22 @@ convert_unicode(NSArray *args) data = [NSData dataWithContentsOfFile: file]; myString = [[NSString alloc] initWithData: data - encoding: NSUTF8StringEncoding]; + encoding: NSUTF8StringEncoding]; AUTORELEASE(myString); if ([myString length] == 0) - myString = [[NSString alloc] initWithData: data - encoding: [NSString defaultCStringEncoding]]; + { + myString = [[NSString alloc] initWithData: data + encoding: [NSString defaultCStringEncoding]]; + } output = [[file lastPathComponent] - stringByAppendingPathExtension: @"unicode"]; + stringByAppendingPathExtension: @"unicode"]; data = [myString dataUsingEncoding: NSUnicodeStringEncoding]; [data writeToFile: output atomically: YES]; } NS_HANDLER { - NSLog(@"Converting '%@' - %@", file, [localException reason]); + GSPrintf(stderr, @"Converting '%@' - %@\n", file, + [localException reason]); } NS_ENDHANDLER } @@ -81,13 +84,14 @@ convert_utf8(NSArray *args) myString = [NSString stringWithContentsOfFile: file]; output = [[file lastPathComponent] - stringByAppendingPathExtension: @"utf8"]; + stringByAppendingPathExtension: @"utf8"]; data = [myString dataUsingEncoding: NSUTF8StringEncoding]; [data writeToFile: output atomically: YES]; } NS_HANDLER { - NSLog(@"Converting '%@' - %@", file, [localException reason]); + GSPrintf(stderr, @"Converting '%@' - %@\n", file, + [localException reason]); } NS_ENDHANDLER } @@ -109,7 +113,7 @@ main(int argc, char** argv, char **env) proc = [NSProcessInfo processInfo]; if (proc == nil) { - NSLog(@"defaults: unable to get process information!\n"); + GSPrintf(stderr, @"defaults: unable to get process information!\n"); [pool release]; exit(0); } @@ -145,16 +149,17 @@ main(int argc, char** argv, char **env) myString = [NSString stringWithContentsOfFile: file]; result = [myString propertyListFromStringsFileFormat]; if (result == nil) - NSLog(@"Parsing '%@' - nil property list", file); + GSPrintf(stderr, @"Parsing '%@' - nil property list\n", file); else if ([result isKindOfClass: [NSDictionary class]] == YES) - NSLog(@"Parsing '%@' - seems ok", file); + GSPrintf(stderr, @"Parsing '%@' - seems ok\n", file); else - NSLog(@"Parsing '%@' - unexpected class - %@", - file, [[result class] description]); + GSPrintf(stderr, @"Parsing '%@' - unexpected class - %@\n", + file, [[result class] description]); } NS_HANDLER { - NSLog(@"Parsing '%@' - %@", file, [localException reason]); + GSPrintf(stderr, @"Parsing '%@' - %@\n", file, + [localException reason]); } NS_ENDHANDLER }