Updated to new event system

Updated the old add_to_log function to the new event system. I am not sure if the correct information is being logged with these changes but the error messages will disappear and the plugin works fine for me.