KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > monolog > api > Logger


1 /**
2  * Copyright (C) 2001-2003 France Telecom R&D
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package org.objectweb.util.monolog.api;
20
21 /**
22  * A Logger implementation receives event messages from an object and exports
23  * them. Each Logger is associated with a log level and discards log requests
24  * that are below this level. Furthermore the Logger interface extends the Handler
25  * interface and represents therefore a type of output.
26  *
27  * @author S.Chassande-Barrioz
28  */

29 public interface Logger extends Handler {
30
31     /**
32      * Permits to set the level with an integer value
33      */

34     void setIntLevel(int level);
35
36     /**
37      * Permits to set the level with a Level instance.
38      */

39     void setLevel(Level l);
40
41     /**
42      * Returns the current level value under the integer format
43      */

44     int getCurrentIntLevel();
45
46     /**
47      * Returns the current level value under the Level format
48      */

49     Level getCurrentLevel();
50     
51     /**
52      * Check if a message of the given level would actually be logged by this logger.
53      */

54     boolean isLoggable(int level);
55
56     /**
57      * Check if a message of the given level would actually be logged by this logger.
58      */

59     boolean isLoggable(Level l);
60
61     /**
62      * Check if this logger is enabled.
63      */

64     boolean isOn();
65     
66     /**
67      * Log a message, with no arguments.
68      * If the logger is currently enabled for the given message level then the
69      * given message is treated
70      */

71     void log(int level, Object JavaDoc message);
72     /**
73      * Log a message, with no arguments.
74      * If the logger is currently enabled for the given message level then the
75      * given message is treated
76      */

77     void log(Level level, Object JavaDoc message);
78
79     /**
80      * Log a message, with a throwable arguments which can represent an
81      * error or a context..
82      */

83     void log(int level, Object JavaDoc message, Throwable JavaDoc throwable);
84     /**
85      * Log a message, with a throwable arguments which can represent an
86      * error or a context..
87      */

88     void log(Level level, Object JavaDoc message, Throwable JavaDoc throwable);
89
90
91     /**
92      * Log a message, with a location and method arguments. The location
93      * parameter can be the object instance which logs the event, or a string
94      * representation of the object.
95      * The method argument can be a java.lang.reflect.Method or a string which
96      * represents the method name.
97      */

98     void log(int level, Object JavaDoc message, Object JavaDoc location, Object JavaDoc method);
99     /**
100      * Log a message, with a location and method arguments. The location
101      * parameter can be the object instance which logs the event, or a string
102      * representation of the object.
103      * The method argument can be a java.lang.reflect.Method or a string which
104      * represents the method name.
105      */

106     void log(Level l, Object JavaDoc message, Object JavaDoc location, Object JavaDoc method);
107
108     /**
109      * Log a message, with a location, method and throwable arguments.
110      * The location parameter can be the object instance which logs the
111      * event, or a string representation of the object..
112      * The method argument can be a java.lang.reflect.Method or a string which
113      * represents the method name.
114      * The throwable parameter permits to log an Exception.
115      */

116     void log(int level, Object JavaDoc message, Throwable JavaDoc throwable,
117         Object JavaDoc location, Object JavaDoc method);
118     /**
119      * Log a message, with a location, method and throwable arguments.
120      * The location parameter can be the object instance which logs the
121      * event, or a string representation of the object..
122      * The method argument can be a java.lang.reflect.Method or a string which
123      * represents the method name.
124      * The throwable parameter permits to log an Exception.
125      */

126     void log(Level level, Object JavaDoc message, Throwable JavaDoc throwable,
127         Object JavaDoc location, Object JavaDoc method);
128
129     /**
130      * Enables this logger
131      */

132     void turnOn();
133
134     /**
135      * Disables this logger
136      */

137     void turnOff();
138
139 }
140
Popular Tags