Sha256: 17d830e3e03f2ee0f6f1c7be1c984fcc8abaaab28cbaf93e05f5ef882fefac57
Contents?: true
Size: 1.45 KB
Versions: 12
Compression:
Stored size: 1.45 KB
Contents
require 'effective_resources' require 'effective_logging/engine' require 'effective_logging/version' module EffectiveLogging def self.config_keys [ :logs_table_name, :layout, :additional_statuses, :active_storage_enabled, :email_enabled, :sign_in_enabled, :sign_out_enabled ] end include EffectiveGem def self.statuses @statuses ||= ( base = [ 'info', 'success', 'error', 'view', log_changes_status, # 'change' ('download' if active_storage_enabled), ('email' if email_enabled), ('sign_in' if sign_in_enabled), ('sign_out' if sign_out_enabled) ].compact additional = Array(additional_statuses).map { |status| status.to_s.downcase } base | additional # union ) end def self.log_changes_status 'change'.freeze end # This is set by the "set_effective_logging_current_user" before_filter. def self.current_user=(user) Thread.current[:effective_logging_current_user] = user end def self.current_user Thread.current[:effective_logging_current_user] end # Used to supress all logging def self.supressed=(value) Thread.current[:effective_logging_supressed] = value end def self.supressed(&block) Thread.current[:effective_logging_supressed] = true yield Thread.current[:effective_logging_supressed] = nil end def self.supressed? Thread.current[:effective_logging_supressed] == true end end
Version data entries
12 entries across 12 versions & 1 rubygems