Loooong time ago I wrote: http://blogs.msdn.com/b/rido/archive/2004/05/07/logsandtraces.aspx

Today I've updated with a revision to use some features that were not available then, like the TraceEventType

As usual it's in my Gist: https://gist.github.com/ridomin/6798405