Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvement #1

Closed
larsgrefer opened this issue Jan 31, 2020 · 1 comment
Closed

Performance improvement #1

larsgrefer opened this issue Jan 31, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@larsgrefer
Copy link

You might want to wrap this in if(logger.isEnabled(level)) { .. }

Class[] parameterTypes = signature.getParameterTypes();
String[] parameterNames = signature.getParameterNames();
Object[] args = joinPoint.getArgs();
StringBuilder parameterTypesAndValuesStrings = new StringBuilder();
for (int i = 0; i < parameterTypes.length; i++) {
Object arg = args[i];
String argument;
if (arg == null) {
argument = "null";
} else {
argument = arg.toString();
}
parameterTypesAndValuesStrings.append("Parameter type: ").append(parameterTypes[i]).append("Parameter name: ")
.append(parameterNames[i]).append(" value: ").append(argument).append(". ");
}
String logString = String
.format("Input arguments for method \"%s\": %s", signature.getName(), parameterTypesAndValuesStrings);
logger.log(Level.valueOf(level.name()), logString);

@reebow reebow added the enhancement New feature or request label Feb 2, 2020
@reebow reebow closed this as completed in 43f0a67 Feb 2, 2020
@reebow
Copy link
Owner

reebow commented Feb 2, 2020

Hi @larsgrefer,
you are right, thank you for your suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants