Sha256: e82e0072af4c7b65cb8c8b3999f38ff9c55cab3c2d869461d12c842cc07f3206

Contents?: true

Size: 478 Bytes

Versions: 3

Compression:

Stored size: 478 Bytes

Contents

class ServiceSkeleton
  module LoggingHelpers
    private

    def log_exception(ex, progname = nil)
      progname ||= "#{self.class.to_s}##{caller_locations(2, 1).first.label}"

      logger.error(progname) do
        #:nocov:
        explanation = if block_given?
          yield
        else
          nil
        end
        #:nocov:

        (["#{explanation}#{explanation ? ": " : ""}#{ex.message} (#{ex.class})"] + ex.backtrace).join("\n  ")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
service_skeleton-0.0.0.3.g1269800.1.gaaa2fa1 lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.3.g1269800 lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.2.g46c1e0e lib/service_skeleton/logging_helpers.rb