added insertLog function