I am logging method name and its parameters values as shown below (pseudo code):
class TestClass
{
void Method(int Param1, int Param2, int Param3)
{
_logger->AddLogEntry("Method",Param1, Param2, Param3);
....
<some work here>
....
}
void AnotherMethod(int Param)
{
_logger->AddLogEntry("AnotherMethod",Param);
....
<some work here>
....
}
.....
}
I am a bit confused about need to write all parameters manually as input parameters in AddLogEntry
method. Its probably to forget one or more parameters when signature of loggable method changed.
Is there any way to automate this step. I mean take all values of all parameters of current method. It would be great if I could take also name of the current method and pair <param name> - <value>