logging and outputting done independently