Move log_formatter into its own method