Skip to content

Commit

Permalink
Use JSON logger formatter only for production environment
Browse files Browse the repository at this point in the history
  • Loading branch information
davydovanton committed May 27, 2016
1 parent 166bb91 commit 02c9895
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/hanami/config/logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,19 @@ def app_name(value = nil)
# @see Hanami::Config::Logger#stream
# @see Hanami::Config::Logger#engine
def build
@engine ||
@engine || _logger_instance
end

private

# @since x.x.x
# @api private
def _logger_instance
if Hanami.env?(:production)
::Hanami::Logger.new(@app_name, stream: @stream, level: @level, formatter: ::Hanami::Logger::JSONFormatter.new)
else
::Hanami::Logger.new(@app_name, stream: @stream, level: @level)
end
end
end
end
Expand Down

0 comments on commit 02c9895

Please sign in to comment.