Made logging optional