added logging functionality