Skip to content

Commit

Permalink
Merge pull request savonrb#636 from krissi/set_httpi_logger
Browse files Browse the repository at this point in the history
Set HTTPI logger to Savon logger
  • Loading branch information
tjarratt committed Nov 12, 2014
2 parents 2b46617 + 0dfa1f0 commit b77dce3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/savon/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ def log(log)

# The logger to use. Defaults to a Savon::Logger instance.
def logger(logger)
HTTPI.logger = logger
@options[:logger] = logger
end

Expand Down
11 changes: 11 additions & 0 deletions spec/savon/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,15 @@ def to_s

expect(logger).to eq(custom_logger)
end

it "sets the logger of HTTPI as well" do
custom_logger = Logger.new($stdout)

client = new_client(:logger => custom_logger, :log => true)

expect(HTTPI.logger).to be custom_logger
end

end

context "global :log_level" do
Expand Down Expand Up @@ -502,6 +511,7 @@ def to_s

# filter out logs we're not interested in
client.globals[:logger].expects(:info).at_least_once
client.globals[:logger].expects(:debug).at_least_once

# check whether the password is filtered
client.globals[:logger].expects(:debug).with { |message|
Expand All @@ -521,6 +531,7 @@ def to_s

# filter out logs we're not interested in
client.globals[:logger].expects(:info).at_least_once
client.globals[:logger].expects(:debug).at_least_once

# check whether the message is pretty printed
client.globals[:logger].expects(:debug).with { |message|
Expand Down

0 comments on commit b77dce3

Please sign in to comment.