diff --git a/lib/stripe/util.rb b/lib/stripe/util.rb index e959f6de7..3d5f4d734 100644 --- a/lib/stripe/util.rb +++ b/lib/stripe/util.rb @@ -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? diff --git a/test/stripe/util_test.rb b/test/stripe/util_test.rb index a36ea1ede..d694dad7e 100644 --- a/test/stripe/util_test.rb +++ b/test/stripe/util_test.rb @@ -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