correct logging subroutine