added support for log_formatting, thanks to http://cbpowell.wordpress.com