Sha256: 72ee9f9c60b567524a3a5816d3c51f71be4e7e33e33040d0b912ce978a767d27

Contents?: true

Size: 732 Bytes

Versions: 27

Compression:

Stored size: 732 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
    true
  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

27 entries across 27 versions & 1 rubygems

Version Path
marty-2.5.2 app/models/marty/log.rb
marty-2.5.1 app/models/marty/log.rb
marty-2.5.0 app/models/marty/log.rb
marty-2.4.9 app/models/marty/log.rb
marty-2.4.8 app/models/marty/log.rb
marty-2.4.7 app/models/marty/log.rb
marty-2.4.6 app/models/marty/log.rb
marty-2.4.5 app/models/marty/log.rb
marty-2.4.4 app/models/marty/log.rb
marty-2.4.3 app/models/marty/log.rb
marty-2.4.2 app/models/marty/log.rb
marty-2.4.1 app/models/marty/log.rb
marty-2.4.0 app/models/marty/log.rb
marty-2.3.15 app/models/marty/log.rb
marty-2.3.14 app/models/marty/log.rb
marty-2.3.13 app/models/marty/log.rb
marty-2.3.12 app/models/marty/log.rb
marty-2.3.11 app/models/marty/log.rb
marty-2.3.10 app/models/marty/log.rb
marty-2.3.9 app/models/marty/log.rb