Update of /cvsroot/log4cocoa/log4cocoa
In directory sc8-pr-cvs1:/tmp/cvs-serv12161
Modified Files:
L4Logger.m
Log Message:
The macros all funnel through the new log4Log function, which is defined here.
Index: L4Logger.m
===================================================================
RCS file: /cvsroot/log4cocoa/log4cocoa/L4Logger.m,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- L4Logger.m 15 Jun 2003 03:18:52 -0000 1.6
+++ L4Logger.m 8 Sep 2003 19:14:23 -0000 1.7
@@ -34,6 +34,7 @@
#import "L4Logger.h"
#import "L4PreprocessorStatics.h"
+#import "L4NSObjectAdditions.h"
static L4Level *_fatal = nil;
static L4Level *_error = nil;
@@ -41,6 +42,40 @@
static L4Level *_info = nil;
static L4Level *_debug = nil;
static NSLock *_loggerLock = nil;
+
+id objc_msgSend(id self, SEL op, ...);
+
+void log4Log(id object, int line, char *file, char *method,
+ SEL sel, BOOL isAssertion, BOOL assertion,
+ id exception, id message, ...)
+{
+ NSString *combinedMessage;
+ if ( [message isKindOfClass:[NSString class]] )
+ {
+ va_list args;
+ va_start(args, message);
+ combinedMessage = [[NSString alloc] initWithFormat:message
+ arguments:args];
+ va_end(args);
+ }
+ else
+ {
+ combinedMessage = [message retain];
+ }
+
+ if ( isAssertion )
+ {
+ objc_msgSend([object l4Logger], sel, line, file, method,
+ assertion, combinedMessage);
+ }
+ else
+ {
+ objc_msgSend([object l4Logger], sel, line, file, method,
+ combinedMessage, exception);
+ }
+
+ [combinedMessage release];
+}
@implementation L4Logger
|