From f6651a60e7b6eeb603bd8cf9a08b95f3db81d983 Mon Sep 17 00:00:00 2001 From: znek Date: Mon, 4 Apr 2005 22:23:15 +0000 Subject: [PATCH] fixed another logging problem git-svn-id: http://svn.opengroupware.org/SOPE/trunk@711 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-core/NGExtensions/ChangeLog | 6 ++++ .../FdExt.subproj/NSObject+Logs.m | 28 +++++++++---------- .../NGExtensions.xcode/project.pbxproj | 2 +- sope-core/NGExtensions/Version | 2 +- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/sope-core/NGExtensions/ChangeLog b/sope-core/NGExtensions/ChangeLog index 32e19896..e63f6a11 100644 --- a/sope-core/NGExtensions/ChangeLog +++ b/sope-core/NGExtensions/ChangeLog @@ -1,3 +1,9 @@ +2005-04-04 Marcus Mueller + + * FdExt.subproj/NSObject+Logs.m: fixed previously broken implementation + of -logger which now has an NSMapTable for class <-> logger + lookup. (v4.5.157) + 2005-03-17 Helge Hess * v4.5.156 diff --git a/sope-core/NGExtensions/FdExt.subproj/NSObject+Logs.m b/sope-core/NGExtensions/FdExt.subproj/NSObject+Logs.m index 65087c56..6f5ba65a 100644 --- a/sope-core/NGExtensions/FdExt.subproj/NSObject+Logs.m +++ b/sope-core/NGExtensions/FdExt.subproj/NSObject+Logs.m @@ -42,22 +42,22 @@ static inline Class NSStringClass(void) { } - (id)logger { - static id logger = nil; - - if (logger == nil) { - NGLoggerManager *lm; - - lm = [NGLoggerManager defaultLoggerManager]; + static NSMapTable *loggerForClassMap = NULL; + static NGLoggerManager *lm = nil; + NGLogger *logger; -#if 0 // broken: if [self class] is passed in, 'logger' can't be a static - logger = [lm loggerForClass:[self class]]; -#else - logger = [lm loggerForClass:[NSObject class]]; -#if 0 - NSLog(@"%@: created logger: %@", self, logger); -#endif -#endif + if (!loggerForClassMap) { + loggerForClassMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks, + NSNonRetainedObjectMapValueCallBacks, + 200); + lm = [NGLoggerManager defaultLoggerManager]; } + logger = NSMapGet(loggerForClassMap, self->isa); + if (!logger) { + logger = [lm loggerForClass:self->isa]; + NSMapInsert(loggerForClassMap, self->isa, logger); + } + return logger; } diff --git a/sope-core/NGExtensions/NGExtensions.xcode/project.pbxproj b/sope-core/NGExtensions/NGExtensions.xcode/project.pbxproj index 41844a00..39ed45ad 100644 --- a/sope-core/NGExtensions/NGExtensions.xcode/project.pbxproj +++ b/sope-core/NGExtensions/NGExtensions.xcode/project.pbxproj @@ -1715,7 +1715,7 @@ ); buildSettings = { DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 4.5.156; + DYLIB_CURRENT_VERSION = 4.5.157; FRAMEWORK_SEARCH_PATHS = "$(LOCAL_LIBRARY_DIR)/Frameworks"; FRAMEWORK_VERSION = A; GCC_PRECOMPILE_PREFIX_HEADER = YES; diff --git a/sope-core/NGExtensions/Version b/sope-core/NGExtensions/Version index 41bb842e..d4e24680 100644 --- a/sope-core/NGExtensions/Version +++ b/sope-core/NGExtensions/Version @@ -1,6 +1,6 @@ # version -SUBMINOR_VERSION:=156 +SUBMINOR_VERSION:=157 # v4.3.115 requires libFoundation v1.0.59 # v4.2.72 requires libEOControl v4.2.39 -- 2.39.5