add write log file functions