Sha256: e05876630786197105cdd576e31ffc50a240927904512d4a720a9224fe021a01

Contents?: true

Size: 723 Bytes

Versions: 41

Compression:

Stored size: 723 Bytes

Contents

class Marty::Log < Marty::Base
  # establish_connection creates a connection using the connection pool
  # based on the current AR connection (i.e. duplicates AR connection)
  establish_connection

  def self.write_log(type, message, details)
    begin
      create!(message_type: type,
              message: message,
              details: details,
              timestamp: Time.zone.now)
    rescue => e
      Marty::Util.logger.error("Marty::Logger failure: #{e.message}")
    end
  end

  def self.cleanup(days_to_keep)
    raise "Must give numeric value. (Got '#{days_to_keep}')" unless
      (Float(days_to_keep) rescue false)
    where("timestamp <= ?", Time.zone.now - days_to_keep.to_i.days).delete_all
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
marty-2.1.5 app/models/marty/log.rb
marty-2.1.4 app/models/marty/log.rb
marty-2.1.3 app/models/marty/log.rb
marty-2.1.2 app/models/marty/log.rb
marty-2.1.1 app/models/marty/log.rb
marty-2.1.0 app/models/marty/log.rb
marty-2.0.9 app/models/marty/log.rb
marty-2.0.8 app/models/marty/log.rb
marty-2.0.7 app/models/marty/log.rb
marty-2.0.6 app/models/marty/log.rb
marty-2.0.5 app/models/marty/log.rb
marty-2.0.4 app/models/marty/log.rb
marty-2.0.3 app/models/marty/log.rb
marty-2.0.2 app/models/marty/log.rb
marty-2.0.1 app/models/marty/log.rb
marty-2.0.0 app/models/marty/log.rb
marty-1.2.9 app/models/marty/log.rb
marty-1.2.8 app/models/marty/log.rb
marty-1.2.7 app/models/marty/log.rb
marty-1.2.6 app/models/marty/log.rb