DEV: Review fixes (#10641)

See comments in https://review.discourse.org/t/dev-imap-log-to-database-10435/14337/6 for context.
This commit is contained in:
Martin Brennan
2020-09-10 13:41:46 +10:00
committed by GitHub
parent e6ca1b4326
commit 7f2f87bf59
4 changed files with 25 additions and 19 deletions

View File

@ -1,17 +1,12 @@
# frozen_string_literal: true
class ImapSyncLog < ActiveRecord::Base
RETAIN_LOGS_DAYS = 5
RETAIN_LOGS_DAYS ||= 5
belongs_to :group
def self.levels
@levels ||= Enum.new(
debug: 1,
info: 2,
warn: 3,
error: 4
)
@levels ||= Enum.new(:debug, :info, :warn, :error)
end
def self.log(message, level, group_id = nil)