diff --git a/ChangeLog b/ChangeLog index a436c7f..6975717 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-03-18 Richard Frith-Macdonald + + * EcProcess.h: + * EcProcess.m: + Add test logging methods ([-ecTestLog:...]) + 2013-03-15 Richard Frith-Macdonald * EcProcess.h: Document EcCoreSize diff --git a/EcProcess.h b/EcProcess.h index 612fb6b..e7ad891 100644 --- a/EcProcess.h +++ b/EcProcess.h @@ -846,6 +846,16 @@ extern NSString* cmdVersion(NSString *ver); */ - (int) ecRun; +/** Logs a message iff the process is running in test mode + * (that is, when EcTesting is set). + */ +- (void) ecTestLog: (NSString*)fmt arguments: (va_list)args; + +/** Logs a message iff the process is running in test mode.
+ * Operates by calling the -ecTestLog:arguments: method. + */ +- (void) ecTestLog: (NSString*)fmt, ...; + @end @interface NSObject (RemoteServerDelegate) diff --git a/EcProcess.m b/EcProcess.m index 09f3ce3..c910bde 100644 --- a/EcProcess.m +++ b/EcProcess.m @@ -2008,7 +2008,7 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval); [c setDelegate: self]; [[NSNotificationCenter defaultCenter] addObserver: self - selector: @selector(connectionBecameInvalid:) + selector: @selector(cmdConnectionBecameInvalid:) name: NSConnectionDidDieNotification object: c]; EcProcConnection = c; @@ -2051,6 +2051,26 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval); return 0; } +- (void) ecTestLog: (NSString*)fmt arguments: (va_list)args +{ + if (YES == cmdFlagTesting) + { + NSLogv(fmt, args); + } +} + +- (void) ecTestLog: (NSString*)fmt, ... +{ + if (YES == cmdFlagTesting) + { + va_list ap; + + va_start (ap, fmt); + [self ecTestLog: fmt arguments: ap]; + va_end (ap); + } +} + - (void) setCmdDebug: (NSString*)mode withDescription: (NSString*)desc { [cmdDebugKnown setObject: desc forKey: mode];