gg.neko.spiceit.util.Patterns Maven / Gradle / Ivy
Show all versions of spiceit-api Show documentation
package gg.neko.spiceit.util;
import gg.neko.spiceit.annotation.LogIt;
/**
* A collection of common log patterns.
*
* Available placeholders are:
*
*
* placeholder
* substitution
* example
*
*
* {@code ${method.class.name}}
* the method declaring class name
* {@code java.lang.String}
*
*
* {@code ${method.class.simpleName}}
* the method declaring class simple name
* {@code String}
*
*
* {@code ${method.name}}
* the method name
* {@code replaceAll}
*
*
* {@code ${method.signature}}
* the method signature
* {@code replaceAll(java.lang.String, java.lang.String)}
*
*
* {@code ${method.longName}}
* the method long name
* {@code java.lang.String.replaceAll(java.lang.String,java.lang.String)}
*
*
* {@code ${method.return}}
* the method return value
* {@code the pencil is on the table}
*
*
* {@code ${method.exception.message}}
* the method exception message
* {@code String index out of range: 420}
*
*
* {@code ${method.args}}
* the method arguments
* {@code [nyan, cat]}
*
*
* {@code ${method.args[$index]}}, e.g.: {@code ${method.args[1]}}
* the {@code $index}-th method argument, starting at 1
* {@code nyan}
*
*
* {@code ${method.time}}
* the method execution time in milliseconds
* {@code 69}
*
*
*
* Note that not all placeholders are available at all times, e.g.: {@code ${method.exception.message}} is only available in {@link LogIt#errorPattern()}.
*/
public class Patterns {
private Patterns() {
throw new UnsupportedOperationException("do not instantiate this class");
}
public static final String LOGIT_ENTRY_DEFAULT = "[ENTRY] class: ${method.class.name}, method: ${method.signature}, args: ${method.args}";
public static final String LOGIT_ENTRY_NO_ARGS = "[ENTRY] class: ${method.class.name}, method: ${method.signature}";
public static final String LOGIT_ENTRY_NO_CLASS = "[ENTRY] method: ${method.signature}, args: ${method.args}";
public static final String LOGIT_ENTRY_NO_ARGS_NO_CLASS = "[ENTRY] method: ${method.signature}";
public static final String LOGIT_ERROR_DEFAULT = "[ERROR] class: ${method.class.name}, method: ${method.signature}, args: ${method.args}, exception: ${method.exception.message}";
public static final String LOGIT_ERROR_NO_ARGS = "[ERROR] class: ${method.class.name}, method: ${method.signature}, exception: ${method.exception.message}";
public static final String LOGIT_ERROR_NO_CLASS = "[ERROR] method: ${method.signature}, args: ${method.args}, exception: ${method.exception.message}";
public static final String LOGIT_ERROR_NO_EXCEPTION_MESSAGE = "[ERROR] class: ${method.class.name}, method: ${method.signature}, args: ${method.args}";
public static final String LOGIT_ERROR_NO_ARGS_NO_CLASS = "[ERROR] method: ${method.signature}, exception: ${method.exception.message}";
public static final String LOGIT_ERROR_NO_ARGS_NO_EXCEPTION_MESSAGE = "[ERROR] class: ${method.class.name}, method: ${method.signature}";
public static final String LOGIT_ERROR_NO_CLASS_NO_EXCEPTION_MESSAGE = "[ERROR] method: ${method.signature}, args: ${method.args}";
public static final String LOGIT_ERROR_NO_ARGS_NO_CLASS_NO_EXCEPTION_MESSAGE = "[ERROR] method: ${method.signature}";
public static final String LOGIT_EXIT_DEFAULT = "[EXIT] class: ${method.class.name}, method: ${method.signature}, args: ${method.args}, return: ${method.return}";
public static final String LOGIT_EXIT_NO_ARGS = "[EXIT] class: ${method.class.name}, method: ${method.signature}, return: ${method.return}";
public static final String LOGIT_EXIT_NO_CLASS = "[EXIT] method: ${method.signature}, args: ${method.args}, return: ${method.return}";
public static final String LOGIT_EXIT_NO_RETURN = "[EXIT] class: ${method.class.name}, method: ${method.signature}, args: ${method.args}";
public static final String LOGIT_EXIT_NO_ARGS_NO_CLASS = "[EXIT] method: ${method.signature}, return: ${method.return}";
public static final String LOGIT_EXIT_NO_ARGS_NO_RETURN = "[EXIT] class: ${method.class.name}, method: ${method.signature}";
public static final String LOGIT_EXIT_NO_CLASS_NO_RETURN = "[EXIT] method: ${method.signature}, args: ${method.args}";
public static final String LOGIT_EXIT_NO_ARGS_NO_CLASS_NO_RETURN = "[EXIT] method: ${method.signature}";
public static final String TIMEIT_DEFAULT = "[TIME] [${method.time}ms] class: ${method.class.name}, method: ${method.signature}";
public static final String TIMEIT_WITH_ARGS = "[TIME] [${method.time}ms] class: ${method.class.name}, method: ${method.signature}, args: ${method.args}";
public static final String TIMEIT_WITH_RETURN = "[TIME] [${method.time}ms] class: ${method.class.name}, method: ${method.signature}, return: ${method.return}";
public static final String TIMEIT_WITH_ARGS_WITH_RETURN = "[TIME] [${method.time}ms] class: ${method.class.name}, method: ${method.signature}, args: ${method.args}, return: ${method.return}";
public static final String TIMEIT_NO_CLASS = "[TIME] [${method.time}ms] method: ${method.signature}";
public static final String TIMEIT_NO_CLASS_WITH_ARGS = "[TIME] [${method.time}ms] method: ${method.signature}, args: ${method.args}";
public static final String TIMEIT_NO_CLASS_WITH_RETURN = "[TIME] [${method.time}ms] method: ${method.signature}, return: ${method.return}";
public static final String TIMEIT_NO_CLASS_WITH_ARGS_WITH_RETURN = "[TIME] [${method.time}ms] method: ${method.signature}, args: ${method.args}, return: ${method.return}";
}