module Eco module API module Common module Session class Logger class Log attr_accessor :level, :datetime, :message, :formatted def initialize(level, datetime, message, formatted) @level = level @datetime = datetime @message = message @formatted = formatted end def to_s formatted end def <=>(other) datetime <=> other.datetime end def before?(value) return true unless value datetime <= to_datetime(value) end def after?(value) return true unless value datetime >= to_datetime(value) end private def to_datetime(value) return value if value.is_a?(Time) return unless value Time.parse(value) end end end end end end end