Updated code to use logger