Java slf4j Logger info(final Logger logger, final String message)

Here you can find the source of info(final Logger logger, final String message)

Description

Log info message.
Is info enabled check will be performed.

License

Open Source License

Parameter

Parameter Description
logger logger instance, can't be <code>null</code>
message logging message

Declaration

public static void info(final Logger logger, final String message) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import org.slf4j.Logger;
import org.slf4j.Marker;

public class Main {
    /**/*from  w ww .  j a v  a2  s.c om*/
     * Log info message.<br>
     * Is info enabled check will be performed.
     * 
     * @param logger
     *            logger instance, can't be <code>null</code>
     * @param message
     *            logging message
     */
    public static void info(final Logger logger, final String message) {
        if (logger.isInfoEnabled())
            logger.info(message);
    }

    /**
     * Log info message.<br>
     * Is info enabled check will be performed.
     * 
     * @param logger
     *            logger instance, can't be <code>null</code>
     * @param format
     *            logging message format, used <code>String.format</code>
     * @param args
     *            logging message format arguments
     */
    public static void info(final Logger logger, final String format, final Object... args) {
        if (logger.isInfoEnabled())
            logger.info(String.format(format, args));
    }

    /**
     * Log info message.<br>
     * Is info enabled check will be performed.
     * 
     * @param logger
     *            logger instance, can't be <code>null</code>
     * @param marker
     *            logging marker
     * @param message
     *            logging message
     */
    public static void info(final Logger logger, final Marker marker, final String message) {
        if (logger.isInfoEnabled())
            logger.info(marker, message);
    }

    /**
     * Log info message.<br>
     * Is info enabled check will be performed.
     * 
     * @param logger
     *            logger instance, can't be <code>null</code>
     * @param marker
     *            logging marker
     * @param format
     *            logging message format, used <code>String.format</code>
     * @param args
     *            logging message format arguments
     */
    public static void info(final Logger logger, final Marker marker, final String format, final Object... args) {
        if (logger.isInfoEnabled())
            logger.info(marker, String.format(format, args));
    }

    /**
     * Log info message.<br>
     * Is info enabled check will be performed.
     * 
     * @param logger
     *            logger instance, can't be <code>null</code>
     * @param message
     *            logging message
     * @param cause
     *            logging cause
     */
    public static void info(final Logger logger, final String message, final Throwable cause) {
        if (logger.isInfoEnabled())
            logger.info(message, cause);
    }

    /**
     * Log info message.<br>
     * Is info enabled check will be performed.
     * 
     * @param logger
     *            logger instance, can't be <code>null</code>
     * @param cause
     *            logging cause
     * @param format
     *            logging message format, used <code>String.format</code>
     * @param args
     *            logging message format arguments
     */
    public static void info(final Logger logger, final Throwable cause, final String format, final Object... args) {
        if (logger.isInfoEnabled())
            logger.info(String.format(format, args), cause);
    }

    /**
     * Log info message.<br>
     * Is info enabled check will be performed.
     * 
     * @param logger
     *            logger instance, can't be <code>null</code>
     * @param marker
     *            logging marker
     * @param message
     *            logging message
     * @param cause
     *            logging cause
     */
    public static void info(final Logger logger, final Marker marker, final String message, final Throwable cause) {
        if (logger.isInfoEnabled())
            logger.info(marker, message, cause);
    }

    /**
     * Log info message.<br>
     * Is info enabled check will be performed.
     * 
     * @param logger
     *            logger instance, can't be <code>null</code>
     * @param marker
     *            logging marker
     * @param cause
     *            logging cause
     * @param format
     *            logging message format, used <code>String.format</code>
     * @param args
     *            logging message format arguments
     */
    public static void info(final Logger logger, final Marker marker, final Throwable cause, final String format,
            final Object... args) {
        if (logger.isInfoEnabled())
            logger.info(marker, String.format(format, args), cause);
    }
}

Related

  1. getMessage(String message, Object... args)
  2. getTraceLevel(Logger logger)
  3. ic static void i(String fmt, Object... args)
  4. info(Class clz, String logStr)
  5. info(final Logger log, final String message, final Object... args)
  6. info(Logger log, Object... objectsToString)
  7. info(Logger logger, String message, Object... objects)
  8. info(Logger logger, String msg)
  9. info(Logger logger, String msg, Object... params)