Sha256: d14e2cec969da31cd78820399ade15be4de4e8730bf38aa685a3a6c35e29a455

Contents?: true

Size: 665 Bytes

Versions: 4

Compression:

Stored size: 665 Bytes

Contents

module Safely
  module Strategy
    class Log
      
      class << self
        
        # Logger to use
        attr_accessor :logger

        # Flush logger
        attr_accessor :flush

        def load!
          @flush ||= false
        end

        def report!( exception )
          return if self.logger.nil?

          self.logger.error("[SAFELY] Type: #{exception.class.name}")
          self.logger.error("[SAFELY] Message: #{exception.message}")
          self.logger.error("[SAFELY] Backtrace: #{exception.backtrace.join("\n  ")}")

          self.logger.flush if self.logger.respond_to?(:flush) && self.flush
        end
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
safely-0.3.2 lib/safely/strategy/log.rb
safely-0.3.1 lib/safely/strategy/log.rb
safely-0.3.0 lib/safely/strategy/log.rb
safely-0.2.0 lib/safely/strategy/log.rb