Sha256: 3a0d560756b6a6e4070972afb7bf5aee2231677017707dd3698ce0cdc3f5defd
Contents?: true
Size: 784 Bytes
Versions: 13
Compression:
Stored size: 784 Bytes
Contents
class Log < ActiveRecord::Base Severities = %w( emerg alert crit err warning notice info debug ) validates_presence_of :severity, :message validates_inclusion_of :severity, in: Severities before_validation :change_severity after_create :to_syslog if Chaltron.enable_syslog private def change_severity self.severity = :emerg if self.severity && self.severity.to_sym == :panic self.severity = :err if self.severity && self.severity.to_sym == :error self.severity = :warning if self.severity && self.severity.to_sym == :warn end def to_syslog Syslog.open(Rails.application.class.parent.to_s, Syslog::LOG_PID, Chaltron.syslog_facility) do |s| s.send(self.severity.to_sym, self.category.upcase + ' - ' + self.message) end end end
Version data entries
13 entries across 13 versions & 1 rubygems