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.impl;
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     * The unique instance of NOPLogger.
48     */
49    public static final NOPLogger NOP_LOGGER = new NOPLogger();
50  
51    /**
52     * There is no point in creating multiple instances of NOPLOgger, 
53     * except by derived classes, hence the protected  access for the constructor.
54     */
55    protected NOPLogger() {
56    }
57  
58    /**
59     * Always returns the string value "NOP".
60     */
61    public String getName() {
62      return "NOP";
63    }
64  
65    /**
66     * Always returns false.
67     * @return always false
68     */
69    final public boolean isTraceEnabled() {
70      return false;
71    }
72  
73    /** A NOP implementation. */
74    final public void trace(String msg) {
75      // NOP
76    }
77  
78    /** A NOP implementation.  */
79    final public void trace(String format, Object arg) {
80      // NOP
81    }
82  
83    /** A NOP implementation.  */
84    public final void trace(String format, Object arg1, Object arg2) {
85      // NOP
86    }
87  
88    /** A NOP implementation.  */
89    public final void trace(String format, Object[] argArray) {
90      // NOP
91    }
92    
93    /** A NOP implementation. */
94    final public void trace(String msg, Throwable t) {
95      // NOP
96    }
97  
98    /**
99     * Always returns false.
100    * @return always false
101    */
102   final public boolean isDebugEnabled() {
103     return false;
104   }
105 
106   /** A NOP implementation. */
107   final public void debug(String msg) {
108     // NOP
109   }
110 
111   /** A NOP implementation.  */
112   final public void debug(String format, Object arg) {
113     // NOP
114   }
115 
116   /** A NOP implementation.  */
117   public final void debug(String format, Object arg1, Object arg2) {
118     // NOP
119   }
120 
121   /** A NOP implementation.  */
122   public final void debug(String format, Object[] argArray) {
123     // NOP
124   }
125   
126   
127   
128   /** A NOP implementation. */
129   final public void debug(String msg, Throwable t) {
130     // NOP
131   }
132 
133   /**
134    * Always returns false.
135    * @return always false
136    */
137   final public boolean isInfoEnabled() {
138     // NOP
139     return false;
140   }
141 
142 
143   /** A NOP implementation. */
144   final public void info(String msg) {
145     // NOP
146   }
147 
148   /** A NOP implementation. */
149   final  public void info(String format, Object arg1) {
150     // NOP
151   }
152 
153   /** A NOP implementation. */
154   final public void info(String format, Object arg1, Object arg2) {
155     // NOP
156   }
157   
158   /** A NOP implementation.  */
159   public final void info(String format, Object[] argArray) {
160     // NOP
161   }
162 
163 
164   /** A NOP implementation. */
165   final public void info(String msg, Throwable t) {
166     // NOP
167   }
168 
169 
170   /**
171    * Always returns false.
172    * @return always false
173    */
174   final public boolean isWarnEnabled() {
175     return false;
176   }
177 
178   /** A NOP implementation. */
179   final public void warn(String msg) {
180     // NOP
181   }
182 
183   /** A NOP implementation. */
184   final public void warn(String format, Object arg1) {
185     // NOP
186   }
187 
188   /** A NOP implementation. */
189   final public void warn(String format, Object arg1, Object arg2) {
190     // NOP
191   }
192   
193   /** A NOP implementation.  */
194   public final void warn(String format, Object[] argArray) {
195     // NOP
196   }
197 
198 
199   /** A NOP implementation. */
200   final public void warn(String msg, Throwable t) {
201     // NOP
202   }
203 
204 
205   /** A NOP implementation. */
206   final public boolean isErrorEnabled() {
207     return false;
208   }
209 
210   /** A NOP implementation. */
211   final public void error(String msg) {
212     // NOP
213   }
214 
215   /** A NOP implementation. */
216   final public void error(String format, Object arg1) {
217     // NOP
218   }
219 
220   /** A NOP implementation. */
221   final public void error(String format, Object arg1, Object arg2) {
222     // NOP
223   }
224   
225   /** A NOP implementation.  */
226   public final void error(String format, Object[] argArray) {
227     // NOP
228   }
229 
230 
231   /** A NOP implementation. */
232   final public void error(String msg, Throwable t) {
233     // NOP
234   }
235 }