...am facing a hard problem, that seems like it must be a common scenario, I should probably...
Write an all new logging tool? Um, no.
Reinvent Sql? Um, no
Use IL generation? Immediately stop whatever it is you're trying to do
The correct course of action Grasshopper is to GOOGLE IT FIRST!!!! If it seems like a function that should be in the .Net framework, it is. If you think that somebody has to have already done this, they have.
Listening to a friend, who shall go nameless to protect the victim's privacy, gripe about some co-irkers. I like my job.