Sha256: da6286b313cc45ffd6a483eb022695d89ab8e23662ea1ab55c871431aa222fdd

Contents?: true

Size: 572 Bytes

Versions: 12

Compression:

Stored size: 572 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

    def logloc
      loc = caller_locations.first
      "#{self.class}##{loc.label}"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
service_skeleton-0.0.0.34.g4f6fdb0 lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.30.g32b8169 lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.29.g23642ab lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.28.gae2711b lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.25.gbf57918 lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.20.gb9a0460 lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.16.g99ff4d7 lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.15.g53952e3 lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.14.g60b4507 lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.13.ga523c90 lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.11.gc1cf3ce lib/service_skeleton/logging_helpers.rb
service_skeleton-0.0.0.3.g1269800.1.gaaa2fa1.6.gf4e308e lib/service_skeleton/logging_helpers.rb