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