KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > dream > util > NullLogger


1 /**
2  * Dream
3  * Copyright (C) 2003-2004 INRIA Rhone-Alpes
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Contact : dream@objectweb.org
20  *
21  * Initial developer(s): Matthieu Leclercq
22  * Contributor(s): Vivien Quema
23  */

24
25 package org.objectweb.dream.util;
26
27 import org.objectweb.util.monolog.api.BasicLevel;
28 import org.objectweb.util.monolog.api.Level;
29 import org.objectweb.util.monolog.api.Logger;
30
31 /**
32  * A null logger each method is empty. This class can be used in a component if
33  * there is no logger rather than test each logging code line if the logger is
34  * <code>null</code>
35  */

36 public class NullLogger implements Logger
37 {
38
39   /**
40    * The unique instance of this class.
41    */

42   public static final NullLogger NULL_LOGGER = new NullLogger();
43
44   /**
45    * Protected constructor, use {@link #NULL_LOGGER}rather construct a new
46    * instance.
47    */

48   protected NullLogger()
49   {
50   }
51
52   /**
53    * @see org.objectweb.util.monolog.api.Logger#setIntLevel(int)
54    */

55   public void setIntLevel(int arg0)
56   {
57   }
58
59   /**
60    * @see org.objectweb.util.monolog.api.Logger#setLevel(org.objectweb.util.monolog.api.Level)
61    */

62   public void setLevel(Level arg0)
63   {
64   }
65
66   /**
67    * returns {@link BasicLevel#FATAL}
68    *
69    * @see org.objectweb.util.monolog.api.Logger#getCurrentIntLevel()
70    */

71   public int getCurrentIntLevel()
72   {
73     return BasicLevel.FATAL;
74   }
75
76   /**
77    * returns {@link BasicLevel#LEVEL_FATAL}
78    *
79    * @see org.objectweb.util.monolog.api.Logger#getCurrentLevel()
80    */

81   public Level getCurrentLevel()
82   {
83     return BasicLevel.LEVEL_FATAL;
84   }
85
86   /**
87    * returns <code>false</code>
88    *
89    * @see org.objectweb.util.monolog.api.Logger#isLoggable(int)
90    */

91   public boolean isLoggable(int arg0)
92   {
93     return false;
94   }
95
96   /**
97    * returns <code>false</code>
98    *
99    * @see org.objectweb.util.monolog.api.Logger#isLoggable(org.objectweb.util.monolog.api.Level)
100    */

101   public boolean isLoggable(Level arg0)
102   {
103     return false;
104   }
105
106   /**
107    * returns <code>false</code>
108    *
109    * @see org.objectweb.util.monolog.api.Logger#isOn()
110    */

111   public boolean isOn()
112   {
113     return false;
114   }
115
116   /**
117    * @see org.objectweb.util.monolog.api.Logger#log(int, java.lang.Object)
118    */

119   public void log(int arg0, Object JavaDoc arg1)
120   {
121   }
122
123   /**
124    * @see org.objectweb.util.monolog.api.Logger#log(org.objectweb.util.monolog.api.Level,
125    * java.lang.Object)
126    */

127   public void log(Level arg0, Object JavaDoc arg1)
128   {
129   }
130
131   /**
132    * @see org.objectweb.util.monolog.api.Logger#log(int, java.lang.Object,
133    * java.lang.Throwable)
134    */

135   public void log(int arg0, Object JavaDoc arg1, Throwable JavaDoc arg2)
136   {
137   }
138
139   /**
140    * @see org.objectweb.util.monolog.api.Logger#log(org.objectweb.util.monolog.api.Level,
141    * java.lang.Object, java.lang.Throwable)
142    */

143   public void log(Level arg0, Object JavaDoc arg1, Throwable JavaDoc arg2)
144   {
145   }
146
147   /**
148    * @see org.objectweb.util.monolog.api.Logger#log(int, java.lang.Object,
149    * java.lang.Object, java.lang.Object)
150    */

151   public void log(int arg0, Object JavaDoc arg1, Object JavaDoc arg2, Object JavaDoc arg3)
152   {
153   }
154
155   /**
156    * @see org.objectweb.util.monolog.api.Logger#log(org.objectweb.util.monolog.api.Level,
157    * java.lang.Object, java.lang.Object, java.lang.Object)
158    */

159   public void log(Level arg0, Object JavaDoc arg1, Object JavaDoc arg2, Object JavaDoc arg3)
160   {
161   }
162
163   /**
164    * @see org.objectweb.util.monolog.api.Logger#log(int, java.lang.Object,
165    * java.lang.Throwable, java.lang.Object, java.lang.Object)
166    */

167   public void log(int arg0, Object JavaDoc arg1, Throwable JavaDoc arg2, Object JavaDoc arg3,
168       Object JavaDoc arg4)
169   {
170   }
171
172   /**
173    * @see org.objectweb.util.monolog.api.Logger#log(org.objectweb.util.monolog.api.Level,
174    * java.lang.Object, java.lang.Throwable, java.lang.Object,
175    * java.lang.Object)
176    */

177   public void log(Level arg0, Object JavaDoc arg1, Throwable JavaDoc arg2, Object JavaDoc arg3,
178       Object JavaDoc arg4)
179   {
180   }
181
182   /**
183    * @see org.objectweb.util.monolog.api.Logger#turnOn()
184    */

185   public void turnOn()
186   {
187   }
188
189   /**
190    * @see org.objectweb.util.monolog.api.Logger#turnOff()
191    */

192   public void turnOff()
193   {
194   }
195
196   /**
197    * @see org.objectweb.util.monolog.api.Handler#getName()
198    */

199   public String JavaDoc getName()
200   {
201     return "NullLogger";
202   }
203
204   /**
205    * @see org.objectweb.util.monolog.api.Handler#setName(java.lang.String)
206    */

207   public void setName(String JavaDoc arg0)
208   {
209   }
210
211   /**
212    * @see org.objectweb.util.monolog.api.Handler#getType()
213    */

214   public String JavaDoc getType()
215   {
216     return "logger";
217   }
218
219   /**
220    * @see org.objectweb.util.monolog.api.Handler#getAttributeNames()
221    */

222   public String JavaDoc[] getAttributeNames()
223   {
224     return new String JavaDoc[0];
225   }
226
227   /**
228    * @see org.objectweb.util.monolog.api.Handler#getAttribute(java.lang.String)
229    */

230   public Object JavaDoc getAttribute(String JavaDoc arg0)
231   {
232     return null;
233   }
234
235   /**
236    * @see org.objectweb.util.monolog.api.Handler#setAttribute(java.lang.String,
237    * java.lang.Object)
238    */

239   public Object JavaDoc setAttribute(String JavaDoc arg0, Object JavaDoc arg1)
240   {
241     return null;
242   }
243 }
Popular Tags