All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mybatis.logging.Logger Maven / Gradle / Ivy

There is a newer version: 5.0.9
Show newest version
/*
 * Copyright 2020 the original author or authors.
 *
 * Licensed under the LGPL, Version 3.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at  http://www.gnu.org/licenses/lgpl-3.0.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.mybatis.logging;


import com.jn.langx.util.function.Supplier0;

import java.util.function.Supplier;

public abstract class Logger {


    /**
     * Case insensitive String constant used to retrieve the name of the root logger.
     *
     * @since 3.3.0
     */
    final public String ROOT_LOGGER_NAME = "ROOT";

    /**
     * Return the name of this Logger instance.
     */
    public abstract String getName();

    /**
     * Is the logger instance enabled for the TRACE level?
     *
     * @return True if this Logger is enabled for the TRACE level,
     * false otherwise.
     * @since 3.3.0
     */
    public abstract boolean isTraceEnabled();


    /**
     * Log a message at the TRACE level.
     *
     * @param msg the message string to be logged
     * @since 3.3.0
     */
    public abstract void trace(String msg);


    /**
     * Log a message at the TRACE level according to the specified format
     * and argument.
     * 

*

This form avoids superfluous object creation when the logger * is disabled for the TRACE level.

* * @param format the format string * @param arg the argument * @since 3.3.0 */ public abstract void trace(String format, Object arg); /** * Log a message at the TRACE level according to the specified format * and arguments. *

*

This form avoids superfluous object creation when the logger * is disabled for the TRACE level.

* * @param format the format string * @param arg1 the first argument * @param arg2 the second argument * @since 3.3.0 */ public abstract void trace(String format, Object arg1, Object arg2); /** * Log a message at the TRACE level according to the specified format * and arguments. *

*

This form avoids superfluous string concatenation when the logger * is disabled for the TRACE level. However, this variant incurs the hidden * (and relatively small) cost of creating an Object[] before invoking the method, * even if this logger is disabled for TRACE. The variants taking {@link #trace(String, Object) one} and * {@link #trace(String, Object, Object) two} arguments exist solely in order to avoid this hidden cost.

* * @param format the format string * @param arguments a list of 3 or more arguments * @since 3.3.0 */ public abstract void trace(String format, Object... arguments); /** * Log an exception (throwable) at the TRACE level with an * accompanying message. * * @param msg the message accompanying the exception * @param t the exception (throwable) to log * @since 3.3.0 */ public abstract void trace(String msg, Throwable t); /** * Is the logger instance enabled for the DEBUG level? * * @return True if this Logger is enabled for the DEBUG level, * false otherwise. */ public abstract boolean isDebugEnabled(); /** * Log a message at the DEBUG level. * * @param msg the message string to be logged */ public abstract void debug(String msg); public abstract void debug(Supplier0 messageSupplier); public abstract void debug(Supplier messageSupplier); /** * Log a message at the DEBUG level according to the specified format * and argument. *

*

This form avoids superfluous object creation when the logger * is disabled for the DEBUG level.

* * @param format the format string * @param arg the argument */ public abstract void debug(String format, Object arg); /** * Log a message at the DEBUG level according to the specified format * and arguments. *

*

This form avoids superfluous object creation when the logger * is disabled for the DEBUG level.

* * @param format the format string * @param arg1 the first argument * @param arg2 the second argument */ public abstract void debug(String format, Object arg1, Object arg2); /** * Log a message at the DEBUG level according to the specified format * and arguments. *

*

This form avoids superfluous string concatenation when the logger * is disabled for the DEBUG level. However, this variant incurs the hidden * (and relatively small) cost of creating an Object[] before invoking the method, * even if this logger is disabled for DEBUG. The variants taking * {@link #debug(String, Object) one} and {@link #debug(String, Object, Object) two} * arguments exist solely in order to avoid this hidden cost.

* * @param format the format string * @param arguments a list of 3 or more arguments */ public abstract void debug(String format, Object... arguments); /** * Log an exception (throwable) at the DEBUG level with an * accompanying message. * * @param msg the message accompanying the exception * @param t the exception (throwable) to log */ public abstract void debug(String msg, Throwable t); /** * Is the logger instance enabled for the INFO level? * * @return True if this Logger is enabled for the INFO level, * false otherwise. */ public abstract boolean isInfoEnabled(); /** * Log a message at the INFO level. * * @param msg the message string to be logged */ public abstract void info(String msg); /** * Log a message at the INFO level according to the specified format * and argument. *

*

This form avoids superfluous object creation when the logger * is disabled for the INFO level.

* * @param format the format string * @param arg the argument */ public abstract void info(String format, Object arg); /** * Log a message at the INFO level according to the specified format * and arguments. *

*

This form avoids superfluous object creation when the logger * is disabled for the INFO level.

* * @param format the format string * @param arg1 the first argument * @param arg2 the second argument */ public abstract void info(String format, Object arg1, Object arg2); /** * Log a message at the INFO level according to the specified format * and arguments. *

*

This form avoids superfluous string concatenation when the logger * is disabled for the INFO level. However, this variant incurs the hidden * (and relatively small) cost of creating an Object[] before invoking the method, * even if this logger is disabled for INFO. The variants taking * {@link #info(String, Object) one} and {@link #info(String, Object, Object) two} * arguments exist solely in order to avoid this hidden cost.

* * @param format the format string * @param arguments a list of 3 or more arguments */ public abstract void info(String format, Object... arguments); /** * Log an exception (throwable) at the INFO level with an * accompanying message. * * @param msg the message accompanying the exception * @param t the exception (throwable) to log */ public abstract void info(String msg, Throwable t); /** * Is the logger instance enabled for the WARN level? * * @return True if this Logger is enabled for the WARN level, * false otherwise. */ public abstract boolean isWarnEnabled(); /** * Log a message at the WARN level. * * @param msg the message string to be logged */ public abstract void warn(String msg); /** * Log a message at the WARN level according to the specified format * and argument. *

*

This form avoids superfluous object creation when the logger * is disabled for the WARN level.

* * @param format the format string * @param arg the argument */ public abstract void warn(String format, Object arg); public abstract void warn(Supplier messageSupplier); public abstract void warn(Supplier0 messageSupplier); /** * Log a message at the WARN level according to the specified format * and arguments. *

*

This form avoids superfluous string concatenation when the logger * is disabled for the WARN level. However, this variant incurs the hidden * (and relatively small) cost of creating an Object[] before invoking the method, * even if this logger is disabled for WARN. The variants taking * {@link #warn(String, Object) one} and {@link #warn(String, Object, Object) two} * arguments exist solely in order to avoid this hidden cost.

* * @param format the format string * @param arguments a list of 3 or more arguments */ public abstract void warn(String format, Object... arguments); /** * Log a message at the WARN level according to the specified format * and arguments. *

*

This form avoids superfluous object creation when the logger * is disabled for the WARN level.

* * @param format the format string * @param arg1 the first argument * @param arg2 the second argument */ public abstract void warn(String format, Object arg1, Object arg2); /** * Log an exception (throwable) at the WARN level with an * accompanying message. * * @param msg the message accompanying the exception * @param t the exception (throwable) to log */ public abstract void warn(String msg, Throwable t); /** * Is the logger instance enabled for the ERROR level? * * @return True if this Logger is enabled for the ERROR level, * false otherwise. */ public abstract boolean isErrorEnabled(); /** * Log a message at the ERROR level. * * @param msg the message string to be logged */ public abstract void error(String msg); /** * Log a message at the ERROR level according to the specified format * and argument. *

*

This form avoids superfluous object creation when the logger * is disabled for the ERROR level.

* * @param format the format string * @param arg the argument */ public abstract void error(String format, Object arg); /** * Log a message at the ERROR level according to the specified format * and arguments. *

*

This form avoids superfluous object creation when the logger * is disabled for the ERROR level.

* * @param format the format string * @param arg1 the first argument * @param arg2 the second argument */ public abstract void error(String format, Object arg1, Object arg2); /** * Log a message at the ERROR level according to the specified format * and arguments. *

*

This form avoids superfluous string concatenation when the logger * is disabled for the ERROR level. However, this variant incurs the hidden * (and relatively small) cost of creating an Object[] before invoking the method, * even if this logger is disabled for ERROR. The variants taking * {@link #error(String, Object) one} and {@link #error(String, Object, Object) two} * arguments exist solely in order to avoid this hidden cost.

* * @param format the format string * @param arguments a list of 3 or more arguments */ public abstract void error(String format, Object... arguments); /** * Log an exception (throwable) at the ERROR level with an * accompanying message. * * @param msg the message accompanying the exception * @param t the exception (throwable) to log */ public abstract void error(String msg, Throwable t); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy