Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions se-commons-logging/src/main/java/de/se_rwth/commons/logging/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Supplier;

/**
* Provides a centralized logging component. Subclasses may provide customized
Expand Down Expand Up @@ -202,6 +203,25 @@ protected void doTrace(String msg, String logName) {
}
}

/**
* Log to the specified log name with level TRACE.
*
* @param msg the trace message
* @param logName the log name to use
*/
public static final void trace(Supplier<String> msg, String logName) {
getLog().doTrace(msg, logName);
}

/**
* Log to the specified log with level TRACE.
*/
protected void doTrace(Supplier<String> msg, String logName) {
if (doIsTraceEnabled(logName)) {
doTrace(msg.get(), logName);
}
}

/**
* Log to the specified log name with level TRACE.
*
Expand All @@ -223,6 +243,26 @@ protected void doTrace(String msg, Throwable t, String logName) {
}
}

/**
* Log to the specified log name with level TRACE.
*
* @param msg the trace message
* @param t the exception to log
* @param logName the log name to use
*/
public static final void trace(Supplier<String> msg, Throwable t, String logName) {
getLog().doTrace(msg, t, logName);
}

/**
* Log to the specified log with level TRACE.<br>
*/
protected void doTrace(Supplier<String> msg, Throwable t, String logName) {
if (doIsTraceEnabled(logName)) {
doTrace(msg.get(), t, logName);
}
}

/**
* Is level DEBUG enabled for the given log name?
*
Expand Down Expand Up @@ -260,6 +300,25 @@ protected void doDebug(String msg, String logName) {
}
}

/**
* Log to the specified log name with level DEBUG.
*
* @param msg the debug message
* @param logName the log name to use
*/
public static final void debug(Supplier<String> msg, String logName) {
getLog().doDebug(msg, logName);
}

/**
* Log to the specified log with level DEBUG.
*/
protected void doDebug(Supplier<String> msg, String logName) {
if (doIsDebugEnabled(logName)) {
doDebug(msg.get(), logName);
}
}

public static final void debug(String msg, SourcePosition pos, String logName) {
getLog().doDebug(msg, pos, logName);
}
Expand All @@ -270,6 +329,16 @@ protected void doDebug(String msg, SourcePosition pos, String logName) {
}
}

public static final void debug(Supplier<String> msg, SourcePosition pos, String logName) {
getLog().doDebug(msg, pos, logName);
}

protected void doDebug(Supplier<String> msg, SourcePosition pos, String logName) {
if (doIsDebugEnabled(logName)) {
doDebug(msg.get(), pos, logName);
}
}

public static final void debug(String msg, SourcePosition start, SourcePosition end, String logName) {
getLog().doDebug(msg, start, end, logName);
}
Expand All @@ -280,6 +349,16 @@ protected void doDebug(String msg, SourcePosition start, SourcePosition end, Str
}
}

public static final void debug(Supplier<String> msg, SourcePosition start, SourcePosition end, String logName) {
getLog().doDebug(msg, start, end, logName);
}

protected void doDebug(Supplier<String> msg, SourcePosition start, SourcePosition end, String logName) {
if (doIsDebugEnabled(logName)) {
doDebug(msg.get(), start, end, logName);
}
}

/**
* Log to the specified log name with level DEBUG.
*
Expand All @@ -301,6 +380,26 @@ protected void doDebug(String msg, Throwable t, String logName) {
}
}

/**
* Log to the specified log name with level DEBUG.
*
* @param msg the debug message
* @param t the exception to log
* @param logName the log name to use
*/
public static final void debug(Supplier<String> msg, Throwable t, String logName) {
getLog().doDebug(msg, t, logName);
}

/**
* Log to the specified log with level DEBUG.
*/
protected void doDebug(Supplier<String> msg, Throwable t, String logName) {
if (doIsDebugEnabled(logName)) {
doDebug(msg.get(), t, logName);
}
}

/**
* Is level INFO enabled for the given log name?
*
Expand Down Expand Up @@ -338,6 +437,25 @@ protected void doInfo(String msg, String logName) {
}
}

/**
* Log to the specified log name with level INFO.
*
* @param msg the info message
* @param logName the log name to use
*/
public static final void info(Supplier<String> msg, String logName) {
getLog().doInfo(msg, logName);
}

/**
* Log to the specified log with level INFO.
*/
protected void doInfo(Supplier<String> msg, String logName) {
if (doIsInfoEnabled(logName)) {
doInfo(msg.get(), logName);
}
}

/**
* Log to the specified log name with level INFO.
*
Expand All @@ -359,6 +477,26 @@ protected void doInfo(String msg, Throwable t, String logName) {
}
}

/**
* Log to the specified log name with level INFO.
*
* @param msg the info message
* @param t the exception to log
* @param logName the log name to use
*/
public static final void info(Supplier<String> msg, Throwable t, String logName) {
getLog().doInfo(msg, t, logName);
}

/**
* Log to the specified log with level INFO.
*/
protected void doInfo(Supplier<String> msg, Throwable t, String logName) {
if (doIsInfoEnabled(logName)) {
doInfo(msg.get(), t, logName);
}
}

/**
* Log with level WARN.
*
Expand Down
Loading