2 Copyright (C) 2004-2005 SKYRIX Software AG
4 This file is part of SOPE.
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
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.
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
22 #ifndef __NGExtensions_NGLogger_H_
23 #define __NGExtensions_NGLogger_H_
28 NGLogger has a minimum log level and passes messages to its appenders
29 only if this minimum log level is satisfied - otherwise it silently drops
32 NGLogger also offers a factory to instantiate loggers from configs stored
35 NOTE: Except in rare circumstances, do not allocate loggers yourself!
36 Always try to use the appropriate API of NGLoggerManager if possible.
39 NGLogger honours the following user default keys:
41 User Default key Function
42 ----------------------------------------------------------------------------
43 NGLogDefaultLogLevel The log level to use as a fallback, if no
44 log level is provided during initialization.
45 The default is "INFO".
48 The following keys in the configuration dictionary will be recognized:
51 ----------------------------------------------------------------------------
52 "LogLevel" The log level to use for this logger. If no
53 log level is provided, sets log level according
54 to fallback described above.
56 "Appenders" Array of dictionaries suitable as configuration
57 provided to NGLogAppender's factory method.
58 Please see NGLogAppender.h for further
63 WOHttpTransactionLoggerConfig = {
67 "Class" = "NGLogStdoutAppender";
69 "Class" = "NGLogEventFormatter";
77 #import <Foundation/NSObject.h>
78 #include <NGExtensions/NGLogLevel.h>
80 @class NSMutableArray, NSString, NSDictionary, NGLogAppender;
82 @interface NGLogger : NSObject
84 NSMutableArray *appenders;
89 + (id)loggerWithConfigFromUserDefaults:(NSString *)_defaultName;
91 - (id)initWithConfig:(NSDictionary *)_config;
92 - (id)initWithLogLevel:(NGLogLevel)_level;
96 - (void)setLogLevel:(NGLogLevel)_level;
97 - (NGLogLevel)logLevel;
99 - (void)addAppender:(NGLogAppender *)_appender;
100 - (void)removeAppender:(NGLogAppender *)_appender;
104 - (void)logLevel:(NGLogLevel)_level message:(NSString *)_msg;
108 - (BOOL)isDebuggingEnabled;
109 - (BOOL)isLogInfoEnabled;
110 - (BOOL)isLogWarnEnabled;
111 - (BOOL)isLogErrorEnabled;
112 - (BOOL)isLogFatalEnabled;
116 #endif /* __NGExtensions_NGLogger_H_ */