1 /*
2  * Copyright (c) 2004-2005 SLF4J.ORG
3  * Copyright (c) 2004-2005 QOS.ch
4  *
5  * All rights reserved.
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining
8  * a copy of this software and associated documentation files (the
9  * "Software"), to  deal in  the Software without  restriction, including
10  * without limitation  the rights to  use, copy, modify,  merge, publish,
11  * distribute, and/or sell copies of  the Software, and to permit persons
12  * to whom  the Software is furnished  to do so, provided  that the above
13  * copyright notice(s) and this permission notice appear in all copies of
14  * the  Software and  that both  the above  copyright notice(s)  and this
15  * permission notice appear in supporting documentation.
16  *
17  * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
18  * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
19  * MERCHANTABILITY, FITNESS FOR  A PARTICULAR PURPOSE AND NONINFRINGEMENT
20  * OF  THIRD PARTY  RIGHTS. IN  NO EVENT  SHALL THE  COPYRIGHT  HOLDER OR
21  * HOLDERS  INCLUDED IN  THIS  NOTICE BE  LIABLE  FOR ANY  CLAIM, OR  ANY
22  * SPECIAL INDIRECT  OR CONSEQUENTIAL DAMAGES, OR  ANY DAMAGES WHATSOEVER
23  * RESULTING FROM LOSS  OF USE, DATA OR PROFITS, WHETHER  IN AN ACTION OF
24  * CONTRACT, NEGLIGENCE  OR OTHER TORTIOUS  ACTION, ARISING OUT OF  OR IN
25  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
26  *
27  * Except as  contained in  this notice, the  name of a  copyright holder
28  * shall not be used in advertising or otherwise to promote the sale, use
29  * or other dealings in this Software without prior written authorization
30  * of the copyright holder.
31  *
32  */

33
34 package org.slf4j.helpers;
35
36 import org.slf4j.Logger;
37 import org.slf4j.helpers.MarkerIgnoringBase;
38
39
40 /**
41  * A direct NOP (no operation) implementation of {@link Logger}.
42  *
43  * @author Ceki Gülcü
44  */

45 public class NOPLogger extends MarkerIgnoringBase {
46
47   private static final long serialVersionUID = -517220405410904473L;
48
49   /**
50    * The unique instance of NOPLogger.
51    */

52   public static final NOPLogger NOP_LOGGER = new NOPLogger();
53
54   /**
55    * There is no point in creating multiple instances of NOPLOgger, 
56    * except by derived classes, hence the protected  access for the constructor.
57    */

58   protected NOPLogger() {
59   }
60
61   /**
62    * Always returns the string value "NOP".
63    */

64   public String getName() {
65     return "NOP";
66   }
67
68   /**
69    * Always returns false.
70    * @return always false
71    */

72   final public boolean isTraceEnabled() {
73     return false;
74   }
75
76   /** A NOP implementation. */
77   final public void trace(String msg) {
78     // NOP
79   }
80
81   /** A NOP implementation.  */
82   final public void trace(String format, Object arg) {
83     // NOP
84   }
85
86   /** A NOP implementation.  */
87   public final void trace(String format, Object arg1, Object arg2) {
88     // NOP
89   }
90
91   /** A NOP implementation.  */
92   public final void trace(String format, Object[] argArray) {
93     // NOP
94   }
95   
96   /** A NOP implementation. */
97   final public void trace(String msg, Throwable t) {
98     // NOP
99   }
100
101   /**
102    * Always returns false.
103    * @return always false
104    */

105   final public boolean isDebugEnabled() {
106     return false;
107   }
108
109   /** A NOP implementation. */
110   final public void debug(String msg) {
111     // NOP
112   }
113
114   /** A NOP implementation.  */
115   final public void debug(String format, Object arg) {
116     // NOP
117   }
118
119   /** A NOP implementation.  */
120   public final void debug(String format, Object arg1, Object arg2) {
121     // NOP
122   }
123
124   /** A NOP implementation.  */
125   public final void debug(String format, Object[] argArray) {
126     // NOP
127   }
128   
129   
130   
131   /** A NOP implementation. */
132   final public void debug(String msg, Throwable t) {
133     // NOP
134   }
135
136   /**
137    * Always returns false.
138    * @return always false
139    */

140   final public boolean isInfoEnabled() {
141     // NOP
142     return false;
143   }
144
145
146   /** A NOP implementation. */
147   final public void info(String msg) {
148     // NOP
149   }
150
151   /** A NOP implementation. */
152   final  public void info(String format, Object arg1) {
153     // NOP
154   }
155
156   /** A NOP implementation. */
157   final public void info(String format, Object arg1, Object arg2) {
158     // NOP
159   }
160   
161   /** A NOP implementation.  */
162   public final void info(String format, Object[] argArray) {
163     // NOP
164   }
165
166
167   /** A NOP implementation. */
168   final public void info(String msg, Throwable t) {
169     // NOP
170   }
171
172
173   /**
174    * Always returns false.
175    * @return always false
176    */

177   final public boolean isWarnEnabled() {
178     return false;
179   }
180
181   /** A NOP implementation. */
182   final public void warn(String msg) {
183     // NOP
184   }
185
186   /** A NOP implementation. */
187   final public void warn(String format, Object arg1) {
188     // NOP
189   }
190
191   /** A NOP implementation. */
192   final public void warn(String format, Object arg1, Object arg2) {
193     // NOP
194   }
195   
196   /** A NOP implementation.  */
197   public final void warn(String format, Object[] argArray) {
198     // NOP
199   }
200
201
202   /** A NOP implementation. */
203   final public void warn(String msg, Throwable t) {
204     // NOP
205   }
206
207
208   /** A NOP implementation. */
209   final public boolean isErrorEnabled() {
210     return false;
211   }
212
213   /** A NOP implementation. */
214   final public void error(String msg) {
215     // NOP
216   }
217
218   /** A NOP implementation. */
219   final public void error(String format, Object arg1) {
220     // NOP
221   }
222
223   /** A NOP implementation. */
224   final public void error(String format, Object arg1, Object arg2) {
225     // NOP
226   }
227   
228   /** A NOP implementation.  */
229   public final void error(String format, Object[] argArray) {
230     // NOP
231   }
232
233
234   /** A NOP implementation. */
235   final public void error(String msg, Throwable t) {
236     // NOP
237   }
238 }
239