Sha256: 1625a5a79af9109279993fef9cf2ed6176aae8f2f1366ae5cc3a5ab2d47fb2b1

Contents?: true

Size: 641 Bytes

Versions: 3

Compression:

Stored size: 641 Bytes

Contents

module GitlabAwesomeRelease
  module GitlabLoggingExt
    [:get, :post, :put, :delete].each do |method|
      define_method method do |path, options = {}|
        begin
          start_time = Time.now

          super(path, options)
        ensure
          end_time = Time.now

          # NOTE: options[:headers] contains PRIVATE-TOKEN
          _options = options.reject{ |k, _v| k == :headers }
          logger.debug "(#{end_time - start_time} sec) #{method.upcase} #{path} #{_options}"
        end
      end
    end
  end
end

Gitlab::Request.class_eval do
  prepend GitlabAwesomeRelease::GitlabLoggingExt
  cattr_accessor :logger
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gitlab_awesome_release-0.1.0 lib/gitlab_awesome_release/gitlab_logging_ext.rb
gitlab_awesome_release-0.1.0.beta8 lib/gitlab_awesome_release/gitlab_logging_ext.rb
gitlab_awesome_release-0.1.0.beta7 lib/gitlab_awesome_release/gitlab_logging_ext.rb