Sha256: 518a8ac5fd4cf4e250875f586dd727962b4e8bbcc20adf08afb465bb0fdb1e5d

Contents?: true

Size: 521 Bytes

Versions: 1

Compression:

Stored size: 521 Bytes

Contents

module Rlyeh
  module Logger
    module_function

    [:debug, :info, :warn, :error, :fatal].each do |level|
      define_method level do |message|
        Rlyeh.logger.__send__(level, message) if Rlyeh.logger
      end
    end

    def crash(exception, message = nil)
      error [message, format_exception(exception)].compact.join("\n")
    end

    def format_exception(exception)
      str = "#{exception.class}: #{exception.to_s}\n"
      str << exception.backtrace.map { |s| "  #{s}" }.join("\n")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rlyeh-0.1.1 lib/rlyeh/logger.rb