问题描述
我正在尝试编写一个通用记录器,将从每个方法条目中调用该记录器.
记录器应打印方法名称和输入值-如果有的话,可以通过查询stacktrace.
是否可以在不显式传递值的情况下获取值?
更好的方法是为每个方法打印带有实际参数值的stacktrace(例如记录异常时).
只是要清楚-我不是要解决调用堆栈(即:哪个方法调用了哪个方法),而是要如何为每个方法传递值
tx
Jammusi
Hi,
I'm trying to write a generic logger the will be called from each method entry
The logger should print the method name and the input values - if any by querying the stacktrace.
Is there a way to get the values without passing them explicitly?
Even better would be to print the stacktrace with the actual parameters values for each method (when logging exception for instance).
Just to be clear - I am not asking about resolving the call stack (that is: what method called which one) but rather how to get the values passed for each method
tx
Jammusi
推荐答案
这篇关于从StackTrace获取方法参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!