Support specifying log_formats

Rebased @jbussdieker's log_format PR (#391) against master. 

Resolves #391