I am writing a function in C # to register user actions in our system and save them in a database. In particular, I want to register certain functions of business logic as they are called. I came up with a logging method like this:
public static LogMethod(string user, string methodName, object[] parameters, string message)
Inside the method, a function is called for each of the parameters ToString(). For example, for the Foo method, it is called like this:
void Foo(int a, SomeObject b)
{
Logger.LogMethod(username, "Foo", new object[]{a,b}, "Beginning Foo");
}
Is this a good way to register feature calls? What are the best practices for achieving this? Will it affect performance badly?
source
share