Class: Marty::Log
- Inherits:
-
Base
- Object
- ActiveRecord::Base
- Base
- Marty::Log
- Defined in:
- app/models/marty/log.rb
Constant Summary
Constants inherited from Base
Base::COUNT_SIG, Base::DISTINCT_SIG, Base::FIRST_SIG, Base::GROUP_SIG, Base::JOINS_SIG, Base::LAST_SIG, Base::LIMIT_SIG, Base::MCFLY_PT_SIG, Base::NOT_SIG, Base::ORDER_SIG, Base::PLUCK_SIG, Base::SELECT_SIG, Base::WHERE_SIG
Class Method Summary collapse
Methods inherited from Base
get_final_attrs, get_struct_attrs, make_hash, make_openstruct, mcfly_pt
Methods inherited from ActiveRecord::Base
Class Method Details
.cleanup(days_to_keep) ⇒ Object
17 18 19 20 21 |
# File 'app/models/marty/log.rb', line 17 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 |
.write_log(type, message, details) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'app/models/marty/log.rb', line 6 def self.write_log(type, , details) begin create!(message_type: type, message: , details: details, timestamp: Time.zone.now) rescue => e Marty::Util.logger.error("Marty::Logger failure: #{e.}") end end |