NOPLogger xref

View Javadoc

    1   /**
    2    * Copyright (c) 2004-2011 QOS.ch
    3    * All rights reserved.
    4    *
    5    * Permission is hereby granted, free  of charge, to any person obtaining
    6    * a  copy  of this  software  and  associated  documentation files  (the
    7    * "Software"), to  deal in  the Software without  restriction, including
    8    * without limitation  the rights to  use, copy, modify,  merge, publish,
    9    * distribute,  sublicense, and/or sell  copies of  the Software,  and to
    10   * permit persons to whom the Software  is furnished to do so, subject to
    11   * the following conditions:
    12   *
    13   * The  above  copyright  notice  and  this permission  notice  shall  be
    14   * included in all copies or substantial portions of the Software.
    15   *
    16   * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
    17   * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
    18   * MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
    19   * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    20   * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    21   * OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
    22   * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    23   *
    24   */
    25  package org.slf4j.helpers;
    26
    27  import org.slf4j.Logger;
    28  import org.slf4j.helpers.MarkerIgnoringBase;
    29
    30
    31  /**
    32   * A direct NOP (no operation) implementation of {@link Logger}.
    33   *
    34   * @author Ceki G&uuml;lc&uuml;
    35   */
    36  public class NOPLogger extends MarkerIgnoringBase {
    37
    38    private static final long serialVersionUID = -517220405410904473L;
    39
    40    /**
    41     * The unique instance of NOPLogger.
    42     */
    43    public static final NOPLogger NOP_LOGGER = new NOPLogger();
    44
    45    /**
    46     * There is no point in creating multiple instances of NOPLOgger,
    47     * except by derived classes, hence the protected  access for the constructor.
    48     */
    49    protected NOPLogger() {
    50    }
    51
    52    /**
    53     * Always returns the string value "NOP".
    54     */
    55    public String getName() {
    56      return "NOP";
    57    }
    58
    59    /**
    60     * Always returns false.
    61     * @return always false
    62     */
    63    final public boolean isTraceEnabled() {
    64      return false;
    65    }
    66
    67    /** A NOP implementation. */
    68    final public void trace(String msg) {
    69      // NOP
    70    }
    71
    72    /** A NOP implementation.  */
    73    final public void trace(String format, Object arg) {
    74      // NOP
    75    }
    76
    77    /** A NOP implementation.  */
    78    public final void trace(String format, Object arg1, Object arg2) {
    79      // NOP
    80    }
    81
    82    /** A NOP implementation.  */
    83    public final void trace(String format, Object... argArray) {
    84      // NOP
    85    }
    86
    87    /** A NOP implementation. */
    88    final public void trace(String msg, Throwable t) {
    89      // NOP
    90    }
    91
    92    /**
    93     * Always returns false.
    94     * @return always false
    95     */
    96    final public boolean isDebugEnabled() {
    97      return false;
    98    }
    99
    100   /** A NOP implementation. */
    101   final public void debug(String msg) {
    102     // NOP
    103   }
    104
    105   /** A NOP implementation.  */
    106   final public void debug(String format, Object arg) {
    107     // NOP
    108   }
    109
    110   /** A NOP implementation.  */
    111   public final void debug(String format, Object arg1, Object arg2) {
    112     // NOP
    113   }
    114
    115   /** A NOP implementation.  */
    116   public final void debug(String format, Object... argArray) {
    117     // NOP
    118   }
    119
    120
    121
    122   /** A NOP implementation. */
    123   final public void debug(String msg, Throwable t) {
    124     // NOP
    125   }
    126
    127   /**
    128    * Always returns false.
    129    * @return always false
    130    */
    131   final public boolean isInfoEnabled() {
    132     // NOP
    133     return false;
    134   }
    135
    136
    137   /** A NOP implementation. */
    138   final public void info(String msg) {
    139     // NOP
    140   }
    141
    142   /** A NOP implementation. */
    143   final  public void info(String format, Object arg1) {
    144     // NOP
    145   }
    146
    147   /** A NOP implementation. */
    148   final public void info(String format, Object arg1, Object arg2) {
    149     // NOP
    150   }
    151
    152   /** A NOP implementation.  */
    153   public final void info(String format, Object... argArray) {
    154     // NOP
    155   }
    156
    157
    158   /** A NOP implementation. */
    159   final public void info(String msg, Throwable t) {
    160     // NOP
    161   }
    162
    163
    164   /**
    165    * Always returns false.
    166    * @return always false
    167    */
    168   final public boolean isWarnEnabled() {
    169     return false;
    170   }
    171
    172   /** A NOP implementation. */
    173   final public void warn(String msg) {
    174     // NOP
    175   }
    176
    177   /** A NOP implementation. */
    178   final public void warn(String format, Object arg1) {
    179     // NOP
    180   }
    181
    182   /** A NOP implementation. */
    183   final public void warn(String format, Object arg1, Object arg2) {
    184     // NOP
    185   }
    186
    187   /** A NOP implementation.  */
    188   public final void warn(String format, Object... argArray) {
    189     // NOP
    190   }
    191
    192
    193   /** A NOP implementation. */
    194   final public void warn(String msg, Throwable t) {
    195     // NOP
    196   }
    197
    198
    199   /** A NOP implementation. */
    200   final public boolean isErrorEnabled() {
    201     return false;
    202   }
    203
    204   /** A NOP implementation. */
    205   final public void error(String msg) {
    206     // NOP
    207   }
    208
    209   /** A NOP implementation. */
    210   final public void error(String format, Object arg1) {
    211     // NOP
    212   }
    213
    214   /** A NOP implementation. */
    215   final public void error(String format, Object arg1, Object arg2) {
    216     // NOP
    217   }
    218
    219   /** A NOP implementation.  */
    220   public final void error(String format, Object... argArray) {
    221     // NOP
    222   }
    223
    224
    225   /** A NOP implementation. */
    226   final public void error(String msg, Throwable t) {
    227     // NOP
    228   }
    229 }