Skip to content

Commit

Permalink
Round benchmark time in compact mode
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc authored and trusche committed May 10, 2019
1 parent cdece89 commit f5c579a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/httplog/http_log.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def log_data(data)
def log_compact(method, uri, status, seconds)
return unless config.compact_log
status = Rack::Utils.status_code(status) unless status == /\d{3}/
log("#{method.to_s.upcase} #{uri} completed with status code #{status} in #{seconds} seconds")
log("#{method.to_s.upcase} #{uri} completed with status code #{status} in #{seconds.to_f.round(6)} seconds")
end

def log_json(data = {})
Expand Down
2 changes: 1 addition & 1 deletion spec/lib/http_log_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def configure

context 'with compact config' do
let(:compact_log) { true }
it { is_expected.to match(%r{\[httplog\] GET http://#{host}:#{port}#{path}(\?.*)? completed with status code \d{3} in (\d|\.)+}) }
it { is_expected.to match(%r{\[httplog\] GET http://#{host}:#{port}#{path}(\?.*)? completed with status code \d{3} in \d+\.\d{1,6} }) }
it { is_expected.to_not include("Connecting: #{host}:#{port}") }
it { is_expected.to_not include('Response:') }
it { is_expected.to_not include('Data:') }
Expand Down

0 comments on commit f5c579a

Please sign in to comment.