Sha256: 0b941e367fa6c02d0f38d44b4a2d705529cda2d6e72bb129edbcf272004856b0

Contents?: true

Size: 637 Bytes

Versions: 2

Compression:

Stored size: 637 Bytes

Contents

module IronNails

  module Logging

    module ClassLogger

      # provides access for the logger we are using
      # you can override this logger as long as it responds to
      # the methods: debug, info, warn, error, fatal
      def logger
        IRONNAILS_DEFAULT_LOGGER
      end

      # Ensures that a message is logged when the execution of 
      # the specified block throws an error. It will then re-raise the error.
      def log_on_error
        begin
          yield if block_given?
        rescue Exception => e
          logger.error "IronNails Error: #{e}"
          raise e
        end
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ironnails-0.0.3 lib/ironnails/logging/class_logger.rb
ironnails-0.0.1 lib/ironnails/logging/class_logger.rb