Added flush thread(the log will now be flushed every 500ms)
Fixed some DEFINES