    001/*
    002 * Licensed to the Apache Software Foundation (ASF) under one or more
    003 * contributor license agreements.  See the NOTICE file distributed with
    004 * this work for additional information regarding copyright ownership.
    005 * The ASF licenses this file to You under the Apache License, Version 2.0
    006 * (the "License"); you may not use this file except in compliance with
    007 * the License.  You may obtain a copy of the License at
    008 *
    009 *      http://www.apache.org/licenses/LICENSE-2.0
    010 *
    011 * Unless required by applicable law or agreed to in writing, software
    012 * distributed under the License is distributed on an "AS IS" BASIS,
    013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014 * See the License for the specific language governing permissions and
    015 * limitations under the License.
    016 */
    017
    018package org.apache.commons.logging.impl;
    019
    020import java.io.Serializable;
    021
    022import org.apache.commons.logging.Log;
    023
    024/**
    025 * Trivial implementation of Log that throws away all messages. No configurable system properties are supported.
    026 */
    027public class NoOpLog implements Log, Serializable {
    028
    029    /** Serializable version identifier. */
    030    private static final long serialVersionUID = 561423906191706148L;
    031
    032    /** Convenience constructor */
    033    public NoOpLog() {
    034        // no-op
    035    }
    036
    037    /**
    038     * Base constructor
    039     *
    040     * @param ignoredName unused.
    041     */
    042    public NoOpLog(final String ignoredName) {
    043        // no-op
    044    }
    045
    046    /** Do nothing */
    047    @Override
    048    public void debug(final Object message) {
    049        // no-op
    050    }
    051
    052    /** Do nothing */
    053    @Override
    054    public void debug(final Object message, final Throwable t) {
    055        // no-op
    056    }
    057
    058    /** Do nothing */
    059    @Override
    060    public void error(final Object message) {
    061        // no-op
    062    }
    063
    064    /** Do nothing */
    065    @Override
    066    public void error(final Object message, final Throwable t) {
    067        // no-op
    068    }
    069
    070    /** Do nothing */
    071    @Override
    072    public void fatal(final Object message) {
    073        // no-op
    074    }
    075
    076    /** Do nothing */
    077    @Override
    078    public void fatal(final Object message, final Throwable t) {
    079        // no-op
    080    }
    081
    082    /** Do nothing */
    083    @Override
    084    public void info(final Object message) {
    085        // no-op
    086    }
    087
    088    /** Do nothing */
    089    @Override
    090    public void info(final Object message, final Throwable t) {
    091        // no-op
    092    }
    093
    094    /**
    095     * Debug is never enabled.
    096     *
    097     * @return false
    098     */
    099    @Override
    100    public final boolean isDebugEnabled() {
    101        return false;
    102    }
    103
    104    /**
    105     * Error is never enabled.
    106     *
    107     * @return false
    108     */
    109    @Override
    110    public final boolean isErrorEnabled() {
    111        return false;
    112    }
    113
    114    /**
    115     * Fatal is never enabled.
    116     *
    117     * @return false
    118     */
    119    @Override
    120    public final boolean isFatalEnabled() {
    121        return false;
    122    }
    123
    124    /**
    125     * Info is never enabled.
    126     *
    127     * @return false
    128     */
    129    @Override
    130    public final boolean isInfoEnabled() {
    131        return false;
    132    }
    133
    134    /**
    135     * Trace is never enabled.
    136     *
    137     * @return false
    138     */
    139    @Override
    140    public final boolean isTraceEnabled() {
    141        return false;
    142    }
    143
    144    /**
    145     * Warn is never enabled.
    146     *
    147     * @return false
    148     */
    149    @Override
    150    public final boolean isWarnEnabled() {
    151        return false;
    152    }
    153
    154    /** Do nothing */
    155    @Override
    156    public void trace(final Object message) {
    157        // no-op
    158    }
    159
    160    /** Do nothing */
    161    @Override
    162    public void trace(final Object message, final Throwable t) {
    163        // no-op
    164    }
    165
    166    /** Do nothing */
    167    @Override
    168    public void warn(final Object message) {
    169        // no-op
    170    }
    171
    172    /** Do nothing */
    173    @Override
    174    public void warn(final Object message, final Throwable t) {
    175        // no-op
    176    }
    177}