Skip to content

Commit

Permalink
feat(webhooks): simplify request logger format
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jun 30, 2019
1 parent 96769a8 commit c52ade2
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/pact_broker/webhooks/webhook_request_logger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,22 @@ class WebhookRequestLogger

attr_reader :execution_logger, :options

class Formatter < Logger::Formatter
Format = "[%s] %s: %s\n".freeze

def call(severity, time, progname, msg)
Format % [format_datetime(time), severity, msg2str(msg)]
end

def format_datetime(time)
time.strftime(@datetime_format || "%Y-%m-%dT%H:%M:%SZ".freeze)
end
end

def initialize(options)
@log_stream = StringIO.new
@execution_logger = Logger.new(log_stream)
@execution_logger.formatter = Formatter.new
@options = options
end

Expand Down

0 comments on commit c52ade2

Please sign in to comment.