How to write custom eventlog in c