Module: EffectiveLogging
- Includes:
- EffectiveGem
- Defined in:
- lib/effective_logging.rb,
lib/effective_logging/engine.rb,
lib/effective_logging/version.rb,
lib/effective_logging/user_logger.rb,
lib/effective_logging/email_logger.rb,
lib/effective_logging/log_page_views.rb,
lib/effective_logging/set_current_user.rb,
lib/effective_logging/active_record_logger.rb,
lib/effective_logging/active_storage_logger.rb,
lib/generators/effective_logging/install_generator.rb
Defined Under Namespace
Modules: ActiveStorageLogger, Generators, LogPageViews, SetCurrentUser
Classes: ActiveRecordLogger, EmailLogger, Engine, UserLogger
Constant Summary
collapse
- VERSION =
'4.1.2'.freeze
Class Method Summary
collapse
Class Method Details
.config_keys ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/effective_logging.rb', line 6
def self.config_keys
[
:logs_table_name, :layout, :additional_statuses,
:log_class_name,
:active_storage_enabled, :email_enabled, :sign_in_enabled, :sign_out_enabled
]
end
|
.current_user ⇒ Object
49
50
51
|
# File 'lib/effective_logging.rb', line 49
def self.current_user
Thread.current[:effective_logging_current_user]
end
|
.current_user=(user) ⇒ Object
This is set by the “set_effective_logging_current_user” before_filter.
45
46
47
|
# File 'lib/effective_logging.rb', line 45
def self.current_user=(user)
Thread.current[:effective_logging_current_user] = user
end
|
.Log ⇒ Object
16
17
18
|
# File 'lib/effective_logging.rb', line 16
def self.Log
log_class_name&.constantize || Effective::Log
end
|
.log_changes_status ⇒ Object
40
41
42
|
# File 'lib/effective_logging.rb', line 40
def self.log_changes_status
'change'.freeze
end
|
.statuses ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/effective_logging.rb', line 20
def self.statuses
@statuses ||= (
base = [
'info',
'success',
'error',
'view',
log_changes_status, ('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 )
end
|
.supressed(&block) ⇒ Object
58
59
60
61
62
63
|
# File 'lib/effective_logging.rb', line 58
def self.supressed(&block)
Thread.current[:effective_logging_supressed] = true
value = yield
Thread.current[:effective_logging_supressed] = nil
value
end
|
.supressed=(value) ⇒ Object
Used to supress all logging
54
55
56
|
# File 'lib/effective_logging.rb', line 54
def self.supressed=(value)
Thread.current[:effective_logging_supressed] = value
end
|
.supressed? ⇒ Boolean
65
66
67
|
# File 'lib/effective_logging.rb', line 65
def self.supressed?
Thread.current[:effective_logging_supressed] == true
end
|