Added log file messages

created function to write to log file
added log file messages to important functions