extract logging method so that user could override it