Write_log

Added write_log to write to log file on demand instead of hard coding in
main