Factor out log writer from log format helper