Log Writing

The functions LogWrite and FinalLogWrite are completed. again..
testmain, and mytest.h are just being used for testing purposes.