Search in sources :

Example 51 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project cayenne by apache.

the class ModelerLogger method log.

/**
 * Prints common message to the modeler console
 */
void log(String level, String message, Throwable throwable, AttributeSet style, Object... parameters) {
    FormattingTuple tuple = MessageFormatter.arrayFormat(message, parameters);
    getLogConsole().appendMessage(level, tuple.getMessage(), throwable, style);
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 52 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project gradle by gradle.

the class DefaultContextAwareTaskLogger method log.

private void log(LogLevel logLevel, Throwable throwable, String format, Object[] args) {
    FormattingTuple tuple = MessageFormatter.arrayFormat(format, args);
    Throwable loggedThrowable = throwable == null ? tuple.getThrowable() : throwable;
    log(logLevel, loggedThrowable, tuple.getMessage());
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 53 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project metron by apache.

the class PerformanceLogger method log.

/**
 * Log a message at DEBUG level according to the specified format and argument.
 *
 * <p>This form avoids superfluous string concatenation when the logger
 * is disabled for the DEBUG level.</p>
 *
 * @param markName  name of the marked timer to log elapsed time for
 * @param format    the format string
 * @param arg1      first argument to the format String
 * @param arg2      second argument to the format String
 */
public void log(String markName, String format, Object arg1, Object arg2) {
    if (okToLog()) {
        FormattingTuple formattedMessage = MessageFormatter.format(format, arg1, arg2);
        log(markName, formattedMessage.getMessage());
    }
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 54 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project jfinal by jfinal.

the class Slf4jLog method info.

public void info(String format, Object... args) {
    if (isInfoEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, args);
        log.log(null, callerFQCN, LocationAwareLogger.INFO_INT, ft.getMessage(), NULL_ARGS, ft.getThrowable());
    }
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Example 55 with FormattingTuple

use of org.slf4j.helpers.FormattingTuple in project jfinal by jfinal.

the class Slf4jLog method trace.

// -------------------------------------------------------
public void trace(String format, Object... args) {
    if (isTraceEnabled()) {
        FormattingTuple ft = MessageFormatter.arrayFormat(format, args);
        log.log(null, callerFQCN, LocationAwareLogger.TRACE_INT, ft.getMessage(), NULL_ARGS, ft.getThrowable());
    }
}
Also used : FormattingTuple(org.slf4j.helpers.FormattingTuple)

Aggregations

FormattingTuple (org.slf4j.helpers.FormattingTuple)61 LocationAwareLogger (org.slf4j.spi.LocationAwareLogger)5 LogRecord (java.util.logging.LogRecord)4 LogTask (alien4cloud.topology.task.LogTask)3 LogCapture (org.opendaylight.infrautils.testutils.LogCapture)2 DolphinLoggerBridge (com.canoo.platform.logging.spi.DolphinLoggerBridge)1 LogMessage (com.canoo.platform.logging.spi.LogMessage)1 StringReader (java.io.StringReader)1 StringWriter (java.io.StringWriter)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 JsonObject (javax.json.JsonObject)1 Test (org.junit.Test)1