Java slf4j Logger traceLog(final Logger log, final String logMethodName, String logMsg)

Here you can find the source of traceLog(final Logger log, final String logMethodName, String logMsg)

Description

TODO

License

Apache License

Parameter

Parameter Description
log TODO
logMethodName TODO
logMsg TODO

Declaration

public static void traceLog(final Logger log, final String logMethodName, String logMsg) 

Method Source Code


//package com.java2s;
/*//  w  w w  . j a v a2s.co  m
 * Copyright ? 2016 Liaison Technologies, Inc.
 *
 * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
 *
 * 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.
 */

import org.slf4j.Logger;

public class Main {
    /**
     * TODO
     * @param log TODO
     * @param logMethodName TODO
     * @param logMsg TODO
     * @param exc TODO
     */
    public static void traceLog(final Logger log, final String logMethodName, String logMsg, final Throwable exc) {
        // >>>>> LOG >>>>>
        if (log.isTraceEnabled()) {
            logMsg = "[" + logMethodName + "] " + logMsg;
            if (exc != null) {
                log.trace(logMsg, exc);
            } else {
                log.trace(logMsg);
            }
        } else if (log.isDebugEnabled()) {
            if (exc != null) {
                log.debug(logMsg, exc);
            } else {
                log.debug(logMsg);
            }
        }
        // <<<<< log <<<<<
    }

    /**
     * TODO
     * @param log TODO
     * @param logMethodName TODO
     * @param logMsg TODO
     */
    public static void traceLog(final Logger log, final String logMethodName, String logMsg) {
        traceLog(log, logMethodName, logMsg, null);
    }
}

Related

  1. startTestLogging(String name)
  2. stopTestLogging()
  3. stringifyStackTrace(Exception e)
  4. testLogError(String errorMessage, Exception ex)
  5. traceCall(Class objectClass)
  6. warn(Logger log, Object... args)
  7. warn(String format, Object... arguments)
  8. warn(String message)
  9. warn(String msg)