Sha256: 734103f87a7f916d06a8a91f53fae2a77fe33fb45eca08209187a2f7c3f4effe

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

require 'logger'

module RabbitRPC

  module Logging

    def self.included(base)
      base.send :include, Methods
      base.extend Methods
    end

    module Methods
      def logger
        RabbitRPC::Logging.logger
      end

      # TODO: logger options
      def log_exception(ex)
        RabbitRPC::Logging.log_exception(ex)
      end
    end

    def self.logger(target = $stdout)
      @logger ||= Logger.new(target)
    end

    def self.log_exception(ex)
      logger.error ('Message: ' + ex.message)
      logger.error (['backtrace:'] + ex.backtrace).join("\n")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rabbit_rpc-0.0.2 lib/rabbit_rpc/logging.rb