2 Copyright (C) 2004 SKYRIX Software AG
4 This file is part of OpenGroupware.org.
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
22 #ifndef __NGExtensions_NGLoggerManager_H_
23 #define __NGExtensions_NGLoggerManager_H_
28 Manages a set of loggers by associating logger instances with names. Thus
29 clients will be given the same instances if accessing the manager with the
30 same name/key. Also, NGLoggerManager offers conditional creation of loggers
31 based on user default keys (and special values associated with these keys).
33 NGLoggerManager honours the following user default keys:
35 User Default key Function
36 ----------------------------------------------------------------------------
37 <Name>LoggerConfig contains the configuration of the logger
38 named <Name>. Depending on what method you used
39 to retrieve the logger, <Name> is either
40 the user default key, class name or another
41 arbitrary name. The config found for that key
42 is used to initialize the logger instance.
44 NGLogDebugAllEnabled if set to "YES" will always return a logger
45 when -loggerForDefaultKey: is called.
49 #import <Foundation/NSObject.h>
51 @class NSString, NSMutableDictionary;
54 @interface NGLoggerManager : NSObject
56 NSMutableDictionary *loggerMap;
59 + (id)defaultLoggerManager;
61 /* Retrieves a logger conditional to the existence of the given default key.
62 In order to stay backwards compatible to existing applications, a boolean
63 value auf YES associated with this key sets the default log level of this
64 logger to NGLogLevelDebug. If the requested default key is not set, *nil* is
67 - (NGLogger *)loggerForDefaultKey:(NSString *)_defaultKey;
69 /* Retrieves a "named" logger with NGLogLevelAll. */
70 - (NGLogger *)loggerForFacilityNamed:(NSString *)_name;
71 - (NGLogger *)loggerForClass:(Class)_clazz;
75 #endif /* __NGExtensions_NGLoggerManager_H_ */