Skip to content

Commit

Permalink
Merge pull request #664 from jasonwebster/do_not_colorize_logger_logging
Browse files Browse the repository at this point in the history
Do not colorize output destined for configured logger
  • Loading branch information
brandur-stripe authored Jul 19, 2018
2 parents 74b25a4 + 9d0cd25 commit b3eb5d3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/stripe/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def self.level_name(level)
def self.log_internal(message, data = {}, color: nil, level: nil, logger: nil, out: nil)
data_str = data.reject { |_k, v| v.nil? }
.map do |(k, v)|
format("%s=%s", colorize(k, color, !out.nil? && out.isatty), wrap_logfmt_value(v))
format("%s=%s", colorize(k, color, logger.nil? && !out.nil? && out.isatty), wrap_logfmt_value(v))
end.join(" ")

if !logger.nil?
Expand Down
2 changes: 1 addition & 1 deletion test/stripe/util_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def isatty
}

Util.send(:log_internal, "message", { foo: "bar" },
color: :green, level: Stripe::LEVEL_DEBUG, logger: logger, out: nil)
color: :green, level: Stripe::LEVEL_DEBUG, logger: logger, out: $stdout)
assert_equal "message=message foo=bar",
out.string
end
Expand Down

0 comments on commit b3eb5d3

Please sign in to comment.