delombok.io.github.qsy7.logging.util.MethodLogUtil Maven / Gradle / Ivy
The newest version!
// Generated by delombok at Fri Apr 08 14:43:06 EDT 2022
package io.github.qsy7.logging.util;
import io.github.qsy7.logging.enumeration.LogLevel;
import org.slf4j.LoggerFactory;
public class MethodLogUtil {
public static long onEnter(final LogLevel logLevel, final String typeName, final String methodName, Object[] arguments) {
logLevel.log(LoggerFactory.getLogger(typeName), "{}({})", methodName, ArgumentUtil.getArguments(false, arguments));
return System.nanoTime();
}
public static void onExit(final LogLevel logLevel, final String typeName, final String methodName, Object[] arguments, Object result, final long startTime) {
logLevel.log(LoggerFactory.getLogger(typeName), "{}({}) => {} in {}ns", methodName, ArgumentUtil.getArguments(false, arguments), ArgumentUtil.getArgument(false, result), (System.nanoTime() - startTime));
}
@java.lang.SuppressWarnings("all")
private MethodLogUtil() {
}
}