    001/**
    002 * Copyright (c) 2004-2011 QOS.ch
    003 * All rights reserved.
    004 *
    005 * Permission is hereby granted, free  of charge, to any person obtaining
    006 * a  copy  of this  software  and  associated  documentation files  (the
    007 * "Software"), to  deal in  the Software without  restriction, including
    008 * without limitation  the rights to  use, copy, modify,  merge, publish,
    009 * distribute,  sublicense, and/or sell  copies of  the Software,  and to
    010 * permit persons to whom the Software  is furnished to do so, subject to
    011 * the following conditions:
    012 *
    013 * The  above  copyright  notice  and  this permission  notice  shall  be
    014 * included in all copies or substantial portions of the Software.
    015 *
    016 * THE  SOFTWARE IS  PROVIDED  "AS  IS", WITHOUT  WARRANTY  OF ANY  KIND,
    017 * EXPRESS OR  IMPLIED, INCLUDING  BUT NOT LIMITED  TO THE  WARRANTIES OF
    018 * MERCHANTABILITY,    FITNESS    FOR    A   PARTICULAR    PURPOSE    AND
    019 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
    020 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
    021 * OF CONTRACT, TORT OR OTHERWISE,  ARISING FROM, OUT OF OR IN CONNECTION
    022 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    023 *
    024 */
    025package org.slf4j.helpers;
    026
    027import org.slf4j.Logger;
    028import org.slf4j.helpers.MarkerIgnoringBase;
    029
    030/**
    031 * A direct NOP (no operation) implementation of {@link Logger}.
    032 *
    033 * @author Ceki G&uuml;lc&uuml;
    034 */
    035public class NOPLogger extends MarkerIgnoringBase {
    036
    037    private static final long serialVersionUID = -517220405410904473L;
    038
    039    /**
    040     * The unique instance of NOPLogger.
    041     */
    042    public static final NOPLogger NOP_LOGGER = new NOPLogger();
    043
    044    /**
    045     * There is no point in creating multiple instances of NOPLogger,
    046     * except by derived classes, hence the protected  access for the constructor.
    047     */
    048    protected NOPLogger() {
    049    }
    050
    051    /**
    052     * Always returns the string value "NOP".
    053     */
    054    public String getName() {
    055        return "NOP";
    056    }
    057
    058    /**
    059     * Always returns false.
    060     * @return always false
    061     */
    062    final public boolean isTraceEnabled() {
    063        return false;
    064    }
    065
    066    /** A NOP implementation. */
    067    final public void trace(String msg) {
    068        // NOP
    069    }
    070
    071    /** A NOP implementation.  */
    072    final public void trace(String format, Object arg) {
    073        // NOP
    074    }
    075
    076    /** A NOP implementation.  */
    077    public final void trace(String format, Object arg1, Object arg2) {
    078        // NOP
    079    }
    080
    081    /** A NOP implementation.  */
    082    public final void trace(String format, Object... argArray) {
    083        // NOP
    084    }
    085
    086    /** A NOP implementation. */
    087    final public void trace(String msg, Throwable t) {
    088        // NOP
    089    }
    090
    091    /**
    092     * Always returns false.
    093     * @return always false
    094     */
    095    final public boolean isDebugEnabled() {
    096        return false;
    097    }
    098
    099    /** 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}