From: <chi...@us...> - 2003-06-16 15:54:21
|
Update of /cvsroot/log4cocoa/log4cocoa In directory sc8-pr-cvs1:/tmp/cvs-serv9742 Modified Files: L4Logger.h L4NSObjectAdditions.h L4NSObjectAdditions.m readme.txt Log Message: renamed NSObject category methods from logger --> l4Logger, to be more paranoid. Should not effect anyone since most people will use the convenience macros instead, updated readme too. Index: L4Logger.h =================================================================== RCS file: /cvsroot/log4cocoa/log4cocoa/L4Logger.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- L4Logger.h 16 Jun 2003 02:50:04 -0000 1.5 +++ L4Logger.h 16 Jun 2003 15:54:16 -0000 1.6 @@ -69,19 +69,19 @@ #define L4LogFatal L4_LOCATION fatal #define L4LogAssert L4_LOCATION assert -#define log4Debug(message) if([[self logger] isDebugEnabled]) [[self logger] L4LogDebug: message] -#define log4Info(message) if([[self logger] isInfoEnabled]) [[self logger] L4LogInfo: message] -#define log4Warn(message) [[self logger] L4LogWarn: message] -#define log4Error(message) [[self logger] L4LogError: message] -#define log4Fatal(message) [[self logger] L4LogFatal: message] +#define log4Debug(message) if([[self l4Logger] isDebugEnabled]) [[self l4Logger] L4LogDebug: message] +#define log4Info(message) if([[self l4Logger] isInfoEnabled]) [[self l4Logger] L4LogInfo: message] +#define log4Warn(message) [[self l4Logger] L4LogWarn: message] +#define log4Error(message) [[self l4Logger] L4LogError: message] +#define log4Fatal(message) [[self l4Logger] L4LogFatal: message] -#define log4DebugWithException(message, e) if([[self logger] isDebugEnabled]) [[self logger] L4LogDebug: message exception: e] -#define log4InfoWithException(message, e) if([[self logger] isInfoEnabled]) [[self logger] L4LogInfo: message exception: e] -#define log4WarnWithException(message, e) [[self logger] L4LogWarn: message exception: e] -#define log4ErrorWithException(message, e) [[self logger] L4LogError: message exception: e] -#define log4FatalWithException(message, e) [[self logger] L4LogFatal: message exception: e] +#define log4DebugWithException(message, e) if([[self l4Logger] isDebugEnabled]) [[self l4Logger] L4LogDebug: message exception: e] +#define log4InfoWithException(message, e) if([[self l4Logger] isInfoEnabled]) [[self l4Logger] L4LogInfo: message exception: e] +#define log4WarnWithException(message, e) [[self l4Logger] L4LogWarn: message exception: e] +#define log4ErrorWithException(message, e) [[self l4Logger] L4LogError: message exception: e] +#define log4FatalWithException(message, e) [[self l4Logger] L4LogFatal: message exception: e] -#define log4Assert(assertion, message) [[self logger] L4LogAssert: assertion log: message] +#define log4Assert(assertion, message) [[self l4Logger] L4LogAssert: assertion log: message] /***** * NOTE: THESE FOLLOWING MACROS WILL GO AWAY IN 1.0. THEY ARE JUST BEING KEPT AROUND FOR @@ -89,19 +89,19 @@ */ #warning "REMEMBER TO DELETE COMPATIBLITY MACROS IN L4Logger.h" // -#define L4Debug(message) if([[self logger] isDebugEnabled]) [[self logger] L4LogDebug: message] -#define L4Info(message) if([[self logger] isInfoEnabled]) [[self logger] L4LogInfo: message] -#define L4Warn(message) [[self logger] L4LogWarn: message] -#define L4Error(message) [[self logger] L4LogError: message] -#define L4Fatal(message) [[self logger] L4LogFatal: message] +#define L4Debug(message) if([[self l4Logger] isDebugEnabled]) [[self l4Logger] L4LogDebug: message] +#define L4Info(message) if([[self l4Logger] isInfoEnabled]) [[self l4Logger] L4LogInfo: message] +#define L4Warn(message) [[self l4Logger] L4LogWarn: message] +#define L4Error(message) [[self l4Logger] L4LogError: message] +#define L4Fatal(message) [[self l4Logger] L4LogFatal: message] -#define L4DebugWithException(message, e) if([[self logger] isDebugEnabled]) [[self logger] L4LogDebug: message exception: e] -#define L4InfoWithException(message, e) if([[self logger] isInfoEnabled]) [[self logger] L4LogInfo: message exception: e] -#define L4WarnWithException(message, e) [[self logger] L4LogWarn: message exception: e] -#define L4ErrorWithException(message, e) [[self logger] L4LogError: message exception: e] -#define L4FatalWithException(message, e) [[self logger] L4LogFatal: message exception: e] +#define L4DebugWithException(message, e) if([[self l4Logger] isDebugEnabled]) [[self l4Logger] L4LogDebug: message exception: e] +#define L4InfoWithException(message, e) if([[self l4Logger] isInfoEnabled]) [[self l4Logger] L4LogInfo: message exception: e] +#define L4WarnWithException(message, e) [[self l4Logger] L4LogWarn: message exception: e] +#define L4ErrorWithException(message, e) [[self l4Logger] L4LogError: message exception: e] +#define L4FatalWithException(message, e) [[self l4Logger] L4LogFatal: message exception: e] -#define L4Assert(assertion, message) [[self logger] L4LogAssert: assertion log: message] +#define L4Assert(assertion, message) [[self l4Logger] L4LogAssert: assertion log: message] Index: L4NSObjectAdditions.h =================================================================== RCS file: /cvsroot/log4cocoa/log4cocoa/L4NSObjectAdditions.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- L4NSObjectAdditions.h 7 May 2003 07:16:40 -0000 1.3 +++ L4NSObjectAdditions.h 16 Jun 2003 15:54:16 -0000 1.4 @@ -54,8 +54,13 @@ */ @interface NSObject (L4CocoaMethods) +#warning "Remember to remove logger methods, we're going to be more paranoid and rename then l4Logger." + + (L4Logger *) logger; - (L4Logger *) logger; + ++ (L4Logger *) l4Logger; +- (L4Logger *) l4Logger; @end Index: L4NSObjectAdditions.m =================================================================== RCS file: /cvsroot/log4cocoa/log4cocoa/L4NSObjectAdditions.m,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- L4NSObjectAdditions.m 7 May 2003 07:16:40 -0000 1.3 +++ L4NSObjectAdditions.m 16 Jun 2003 15:54:16 -0000 1.4 @@ -42,12 +42,24 @@ @implementation NSObject(L4CocoaMethods) +#warning "Remember to remove logger implementations, we're going to be more paranoid and rename then l4Logger." + + (L4Logger *) logger { return [L4LogManager loggerForClass: (Class) self]; } - (L4Logger *) logger +{ + return [L4LogManager loggerForClass: [self class]]; +} + ++ (L4Logger *) l4Logger +{ + return [L4LogManager loggerForClass: (Class) self]; +} + +- (L4Logger *) l4Logger { return [L4LogManager loggerForClass: [self class]]; } Index: readme.txt =================================================================== RCS file: /cvsroot/log4cocoa/log4cocoa/readme.txt,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- readme.txt 15 Jun 2003 03:20:11 -0000 1.8 +++ readme.txt 16 Jun 2003 15:54:16 -0000 1.9 @@ -40,7 +40,7 @@ Obviously the second way can be coded in numeruous ways, but I just wanted to point out the two approaches. Also, both versions of the Debug & Info macros expand into methods that are wrapped by an "isEnabled" if statement, like so: -if([[self logger] isInfoEnabled]) [[self logger] lineNumber: __LINE__ +if([[self l4Logger] isInfoEnabled]) [[self l4Logger] lineNumber: __LINE__ fileName: __FILE__ methodName: __PRETTY_FUNCTION__ info: message @@ -50,20 +50,20 @@ NOTE: none of these macro's do not include a final semi-colon, so make sure to use one when invoking them. -The 2 core logging convenience methods are implemented as categories on NSObject (if you want to log off of an NSProxy, you'll need to implement these there too ... maybe we'll provide these convenience methods there, but we haven't yet). +The 2 core logging convenience methods are implemented as categories on NSObject (if you want to log off of an NSProxy, you'll need to implement these there too ... maybe we'll provide these convenience methods there, but we haven't yet). Since these are catagories on NSObject we've added the 'l4' prefix to be more paranoid and avoid the remote possiblity of a name collision with someone elses category. @interface NSObject (L4CocoaMethods) - + (L4Logger *) logger; - - (L4Logger *) logger; + + (L4Logger *) l4Logger; + - (L4Logger *) l4Logger; @end -Therefore, [self logger] returns a L4Logger instance based on the calling class object. To log a message, without using the above macros, the usage is: +Therefore, [self l4Logger] returns a L4Logger instance based on the calling class object. To log a message, without using the above macros, the usage is: - [[self logger] l4fatal: @"Crap something fatal happened. You're screwed. Game Over."]; + [[self l4Logger] l4fatal: @"Crap something fatal happened. You're screwed. Game Over."]; - [[self logger] l4debug: @"Debug info goes here. La de da. All the King's horses & all the kings men couldn't put Humpty Dumpty back together again."]; + [[self l4Logger] l4debug: @"Debug info goes here. La de da. All the King's horses & all the kings men couldn't put Humpty Dumpty back together again."]; Frankly, I don't know why you wouldn't want to use these macros, but the non-macro versions are still there in case that's what you want or for some reason you can't use the macro versions. |