View Javadoc

    1   /*
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements. See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache license, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License. You may obtain a copy of the License at
    8    *
    9    *      http://www.apache.org/licenses/LICENSE-2.0
    10   *
    11   * Unless required by applicable law or agreed to in writing, software
    12   * distributed under the License is distributed on an "AS IS" BASIS,
    13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14   * See the license for the specific language governing permissions and
    15   * limitations under the license.
    16   */
    17  package org.apache.logging.log4j.spi;
    18
    19  import org.apache.logging.log4j.Level;
    20  import org.apache.logging.log4j.Logger;
    21  import org.apache.logging.log4j.Marker;
    22  import org.apache.logging.log4j.message.Message;
    23
    24  /**
    25   * Extends the {@code Logger} interface with methods that facilitate implementing or extending {@code Logger}s. Users
    26   * should not need to use this interface.
    27   */
    28  public interface ExtendedLogger extends Logger {
    29
    30      /**
    31       * Determines if logging is enabled.
    32       *
    33       * @param level The logging Level to check.
    34       * @param marker A Marker or null.
    35       * @param message The Message.
    36       * @param t A Throwable.
    37       * @return True if logging is enabled, false otherwise.
    38       */
    39      boolean isEnabled(Level level, Marker marker, Message message, Throwable t);
    40
    41      /**
    42       * Determines if logging is enabled.
    43       *
    44       * @param level The logging Level to check.
    45       * @param marker A Marker or null.
    46       * @param message The message.
    47       * @param t A Throwable.
    48       * @return True if logging is enabled, false otherwise.
    49       */
    50      boolean isEnabled(Level level, Marker marker, Object message, Throwable t);
    51
    52      /**
    53       * Determines if logging is enabled.
    54       *
    55       * @param level The logging Level to check.
    56       * @param marker A Marker or null.
    57       * @param message The message.
    58       * @return True if logging is enabled, false otherwise.
    59       * @param t the exception to log, including its stack trace.
    60       */
    61      boolean isEnabled(Level level, Marker marker, String message, Throwable t);
    62
    63      /**
    64       * Determine if logging is enabled.
    65       *
    66       * @param level The logging Level to check.
    67       * @param marker A Marker or null.
    68       * @param message The message.
    69       * @return True if logging is enabled, false otherwise.
    70       */
    71      boolean isEnabled(Level level, Marker marker, String message);
    72
    73      /**
    74       * Determines if logging is enabled.
    75       *
    76       * @param level The logging Level to check.
    77       * @param marker A Marker or null.
    78       * @param message The message.
    79       * @param params The parameters.
    80       * @return True if logging is enabled, false otherwise.
    81       */
    82      boolean isEnabled(Level level, Marker marker, String message, Object... params);
    83
    84      /**
    85       * Logs a message if the specified level is active.
    86       *
    87       * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
    88       *            method when location information needs to be logged.
    89       * @param level The logging Level to check.
    90       * @param marker A Marker or null.
    91       * @param message The Message.
    92       * @param t the exception to log, including its stack trace.
    93       */
    94      void logIfEnabled(String fqcn, Level level, Marker marker, Message message, Throwable t);
    95
    96      /**
    97       * Logs a message if the specified level is active.
    98       *
    99       * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
    100      *            method when location information needs to be logged.
    101      * @param level The logging Level to check.
    102      * @param marker A Marker or null.
    103      * @param message The message.
    104      * @param t the exception to log, including its stack trace.
    105      */
    106     void logIfEnabled(String fqcn, Level level, Marker marker, Object message, Throwable t);
    107
    108     /**
    109      * Logs a message if the specified level is active.
    110      *
    111      * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
    112      *            method when location information needs to be logged.
    113      * @param level The logging Level to check.
    114      * @param marker A Marker or null.
    115      * @param message The message.
    116      * @param t the exception to log, including its stack trace.
    117      */
    118     void logIfEnabled(String fqcn, Level level, Marker marker, String message, Throwable t);
    119
    120     /**
    121      * Logs a message if the specified level is active.
    122      *
    123      * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
    124      *            method when location information needs to be logged.
    125      * @param level The logging Level to check.
    126      * @param marker A Marker or null.
    127      * @param message The message.
    128      */
    129     void logIfEnabled(String fqcn, Level level, Marker marker, String message);
    130
    131     /**
    132      * Logs a message if the specified level is active.
    133      *
    134      * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
    135      *            method when location information needs to be logged.
    136      * @param level The logging Level to check.
    137      * @param marker A Marker or null.
    138      * @param message The message format.
    139      * @param params The message parameters.
    140      */
    141     void logIfEnabled(String fqcn, Level level, Marker marker, String message, Object... params);
    142
    143     /**
    144      * Always logs a message at the specified level. It is the responsibility of the caller to ensure the specified
    145      * level is enabled.
    146      *
    147      * @param fqcn The fully qualified class name of the logger entry point, used to determine the caller class and
    148      *            method when location information needs to be logged.
    149      * @param level The logging Level to check.
    150      * @param marker A Marker or null.
    151      * @param message The Message.
    152      * @param t the exception to log, including its stack trace.
    153      */
    154     void logMessage(String fqcn, Level level, Marker marker, Message message, Throwable t);
    155 }