use write_log() instead of printf()