Java slf4j Logger logBind(Logger log, int index, Object value)

Here you can find the source of logBind(Logger log, int index, Object value)

Description

log Bind

License

BSD License

Declaration

public static void logBind(Logger log, int index, Object value) 

Method Source Code


//package com.java2s;
/*L//  ww  w .j av a 2s  . c  o  m
 * Copyright Northwestern University.
 *
 * Distributed under the OSI-approved BSD 3-Clause License.
 * See http://ncip.github.io/psc/LICENSE.txt for details.
 */

import org.slf4j.Logger;

public class Main {
    public static void logBind(Logger log, int index, Object value) {
        if (log.isDebugEnabled()) {
            StringBuffer msg = new StringBuffer("binding ");
            appendBoundValue(value, msg);
            msg.append(" to parameter: ").append(index);
            log.debug(msg.toString());
        }
    }

    private static StringBuffer appendBoundValue(Object value, StringBuffer msg) {
        if (value == null) {
            msg.append("null");
        } else {
            msg.append("'").append(value).append("'");
        }
        return msg;
    }
}

Related

  1. log(Logger logger, Throwable t)
  2. log(String format, Object... arguments)
  3. log(String message)
  4. logAndIdError(Logger log, String errorMessage)
  5. logArgs(final Logger logger, final Object[] args)
  6. logBytes(byte[] data, int length, String prefix, Logger logger)
  7. logDebug(Logger logger, String mensagem, Object... params)
  8. logDebug(String string)
  9. logEntrance(Logger logger, String methodName, String methodArguments)