More logging capability

Made a basic logging function that takes in an event code and timestamp
and writes to a log file. Now upornot logs when a connection changes
from online to offline or offline to online.