Sha256: 476468c37af05ba0d5a546ee3f5c9f8baef74d1ee547ca6d5a03eea2cd69e46c
Contents?: true
Size: 772 Bytes
Versions: 3
Compression:
Stored size: 772 Bytes
Contents
require "delegate" require "logger" module Ezid # # Custom logger for EZID client # # @api private class Logger < SimpleDelegator # Logs a message for an EZID request/response # @param request [Ezid::Request] the request # @param response [Ezid::Response] the response def request_and_response(request, response) level = response.error? ? ::Logger::ERROR : ::Logger::INFO response_message = response.status_line message = "EZID #{request_message(request)}: #{response_message}" log(level, message) end private def request_message(request) message = request.operation[0].to_s args = request.operation[1..-1] message << "(#{args.join(', ')})" if args.any? message end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ezid-client-0.3.0 | lib/ezid/logger.rb |
ezid-client-0.2.0 | lib/ezid/logger.rb |
ezid-client-0.1.1 | lib/ezid/logger.rb |