If you want a generic logger for any function, I suggest writing a logging function which takes as parameters a reference to the function to be logged, and the stuff to pass to it. If you're not familiar with function references, think of a C pointer to a function and you'll get the right idea.
Be careful to call the referred to function in the right context - list or scalar or void (see wantarray). You might also want to play games with caller like TheDamian does in his evil Hook::LexWrap.