Refactor show log functionality