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 =
'3.1.5'.freeze
Class Method Summary
collapse
Class Method Details
.config_keys ⇒ Object
8
9
10
11
12
13
|
# File 'lib/effective_logging.rb', line 8
def self.config_keys
[
:logs_table_name, :layout, :additional_statuses,
:active_storage_enabled, :email_enabled, :sign_in_enabled, :sign_out_enabled
]
end
|
.current_user ⇒ Object
46
47
48
|
# File 'lib/effective_logging.rb', line 46
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.
42
43
44
|
# File 'lib/effective_logging.rb', line 42
def self.current_user=(user)
Thread.current[:effective_logging_current_user] = user
end
|
.log_changes_status ⇒ Object
37
38
39
|
# File 'lib/effective_logging.rb', line 37
def self.log_changes_status
'change'.freeze
end
|
.statuses ⇒ Object
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/effective_logging.rb', line 17
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
50
51
52
53
54
|
# File 'lib/effective_logging.rb', line 50
def self.supressed(&block)
Thread.current[:effective_logging_supressed] = true
yield
Thread.current[:effective_logging_supressed] = nil
end
|
.supressed? ⇒ Boolean
56
57
58
|
# File 'lib/effective_logging.rb', line 56
def self.supressed?
Thread.current[:effective_logging_supressed] == true
end
|