Java slf4j Logger logExit(Logger logger, String methodName, String returnValue, long timeSpent)

Here you can find the source of logExit(Logger logger, String methodName, String returnValue, long timeSpent)

Description

Logs for exit from every public methods with Level#DEBUG .

License

Open Source License

Parameter

Parameter Description
methodName The name of method existed from.
returnValue the return value
timeSpent the time spent
logger the logger instance
verboseLogging the control flag defining whether the detailed logging actions should be performed

Declaration

public static void logExit(Logger logger, String methodName, String returnValue, long timeSpent) 

Method Source Code

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

import org.slf4j.Logger;

public class Main {
    /**/*from  www.  j  a  v  a 2  s  .c  o  m*/
     * <p>
     * The message format pattern used to log the exit of method.
     * </p>
     */
    private static final String EXIT_METHOD_PATTERN = "Exiting method %s.\n\tReturn value: [{%s}].\n\tTime spent in the method: {2"
            + "%d} milliseconds.";

    /**
     * <p>
     * Logs for exit from every public methods with {@link Level#DEBUG}.
     * </p>
     *
     * @param methodName     The name of method existed from.
     * @param returnValue    the return value
     * @param timeSpent      the time spent
     * @param logger         the logger instance
     * @param verboseLogging the control flag defining whether the detailed logging actions should be performed
     */
    public static void logExit(Logger logger, String methodName, String returnValue, long timeSpent) {
        logger.debug(String.format(EXIT_METHOD_PATTERN, methodName, returnValue, timeSpent));

    }
}

Related

  1. logError(final Logger logger, final String message, final Throwable cause)
  2. logError(Logger log, Throwable t, String message)
  3. logError(String message, Throwable ex, Logger logger, String userId)
  4. logErrors(Logger logger, List strings)
  5. LogException(Logger log, String descrption, Throwable e)
  6. loggerForThisClass()
  7. loggerWithName(Class klass, String name)
  8. logInfo(Logger log)
  9. logInfo(Logger log, Throwable t)