]> err.no Git - sope/blob - sope-core/NGExtensions/NGExtensions/NGLoggerManager.h
Drop apache 1 build-dependency
[sope] / sope-core / NGExtensions / NGExtensions / NGLoggerManager.h
1 /*
2   Copyright (C) 2004-2005 SKYRIX Software AG
3
4   This file is part of SOPE.
5
6   SOPE 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
9   later version.
10
11   SOPE 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.
15
16   You should have received a copy of the GNU Lesser General Public
17   License along with SOPE; see the file COPYING.  If not, write to the
18   Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
19   02111-1307, USA.
20 */
21
22 #ifndef __NGExtensions_NGLoggerManager_H_
23 #define __NGExtensions_NGLoggerManager_H_
24
25 /*
26   NGLoggerManager
27
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).
32
33   NGLoggerManager honours the following user default keys:
34
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.
43
44   NGLogDebugAllEnabled          if set to "YES" will always return a logger
45                                 when -loggerForDefaultKey: is called.
46
47 */
48
49 #import <Foundation/NSObject.h>
50
51 @class NSString, NSMutableDictionary;
52 @class NGLogger;
53
54 @interface NGLoggerManager : NSObject
55 {
56   NSMutableDictionary *loggerMap;
57 }
58
59 + (id)defaultLoggerManager;
60
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
65    returned.
66 */
67 - (NGLogger *)loggerForDefaultKey:(NSString *)_defaultKey;
68
69 /* Retrieves a "named" logger with NGLogLevelAll. */
70 - (NGLogger *)loggerForFacilityNamed:(NSString *)_name;
71 - (NGLogger *)loggerForClass:(Class)_clazz;
72
73 @end
74
75 #endif  /* __NGExtensions_NGLoggerManager_H_ */