Sha256: 0e832a257be00663b55673248bfd4ac094f8a7e955e5da7aec9a86468156b720

Contents?: true

Size: 741 Bytes

Versions: 8

Compression:

Stored size: 741 Bytes

Contents

module Keystone
  module Base
    def log(log_type,message, is_base_info = true)
      if is_base_info
        puts "[#{Time.now.strftime("%Y/%m/%d %H:%M:%S")}][#{$$}][#{log_type.to_s}] #{message}"
      else
        puts "[#{log_type.to_s}] #{message}"
      end
    end

    def info(message)
      log(:INFO,message)
    end

    def error(message)
      if message.is_a? Exception
        log(:ERROR,"#{message.message}")
        message.backtrace.each_with_index {|line, i|
          log(:ERROR,"#{line})",false)
        }
      else
        log(:ERROR,message.to_s)
      end
    end

    def warn(message)
      log(:WARN,message)
    end

    def debug(message)
      if $DEBUG
        log(:DEBUG,message)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
kanamei-kanamei-keystone-0.0.12 lib/keystone/base.rb
kanamei-kanamei-keystone-0.0.13 lib/keystone/base.rb
kanamei-keystone-0.0.11 lib/keystone/base.rb
kanamei-keystone-0.0.12 lib/keystone/base.rb
kanamei-keystone-0.0.14 lib/keystone/base.rb
kanamei-keystone-0.0.15 lib/keystone/base.rb
kanamei-keystone-0.0.16 lib/keystone/base.rb
kanamei-keystone-0.0.17 lib/keystone/base.rb