Class: AuditLogger::Audit
- Inherits:
-
Logger
- Object
- Logger
- AuditLogger::Audit
- Includes:
- AuditMessageStyles
- Defined in:
- lib/audit_logger.rb
Instance Attribute Summary collapse
-
#al_pid ⇒ Object
readonly
Returns the value of attribute al_pid.
-
#al_severity ⇒ Object
readonly
Returns the value of attribute al_severity.
-
#al_shift_age ⇒ Object
readonly
Returns the value of attribute al_shift_age.
-
#al_shift_size ⇒ Object
readonly
Returns the value of attribute al_shift_size.
-
#al_thread ⇒ Object
readonly
Returns the value of attribute al_thread.
-
#al_timestamp ⇒ Object
readonly
Returns the value of attribute al_timestamp.
-
#log_file_name ⇒ Object
readonly
Returns the value of attribute log_file_name.
Instance Method Summary collapse
- #audit(block_name, log_exception_only: false, do_raise: true, &block) ⇒ Object
- #audit_with_resque(block_name, log_exception_only: false, do_raise: false, &block) ⇒ Object
-
#initialize(file_path = STDOUT, opts = {}) ⇒ Audit
constructor
A new instance of Audit.
Constructor Details
#initialize(file_path = STDOUT, opts = {}) ⇒ Audit
Returns a new instance of Audit.
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/audit_logger.rb', line 19 def initialize(file_path=STDOUT, opts = {}) @al_timestamp = opts[:timestamp] || true @al_pid = opts[:pid] || false @al_severity = opts[:severity] || false @al_thread = opts[:thread] || false @al_shift_age = opts[:shift_age] || 0 @al_shift_size = opts[:shift_size] || 2*1024*1024 log_file = init_log_file(file_path) super(log_file, al_shift_age, al_shift_size) end |
Instance Attribute Details
#al_pid ⇒ Object (readonly)
Returns the value of attribute al_pid.
11 12 13 |
# File 'lib/audit_logger.rb', line 11 def al_pid @al_pid end |
#al_severity ⇒ Object (readonly)
Returns the value of attribute al_severity.
11 12 13 |
# File 'lib/audit_logger.rb', line 11 def al_severity @al_severity end |
#al_shift_age ⇒ Object (readonly)
Returns the value of attribute al_shift_age.
11 12 13 |
# File 'lib/audit_logger.rb', line 11 def al_shift_age @al_shift_age end |
#al_shift_size ⇒ Object (readonly)
Returns the value of attribute al_shift_size.
11 12 13 |
# File 'lib/audit_logger.rb', line 11 def al_shift_size @al_shift_size end |
#al_thread ⇒ Object (readonly)
Returns the value of attribute al_thread.
11 12 13 |
# File 'lib/audit_logger.rb', line 11 def al_thread @al_thread end |
#al_timestamp ⇒ Object (readonly)
Returns the value of attribute al_timestamp.
11 12 13 |
# File 'lib/audit_logger.rb', line 11 def @al_timestamp end |
#log_file_name ⇒ Object (readonly)
Returns the value of attribute log_file_name.
11 12 13 |
# File 'lib/audit_logger.rb', line 11 def log_file_name @log_file_name end |
Instance Method Details
#audit(block_name, log_exception_only: false, do_raise: true, &block) ⇒ Object
37 38 39 |
# File 'lib/audit_logger.rb', line 37 def audit(block_name, log_exception_only: false, do_raise: true, &block) perform_with_audit(block_name, log_exception_only: log_exception_only, do_raise: do_raise, &block) end |
#audit_with_resque(block_name, log_exception_only: false, do_raise: false, &block) ⇒ Object
33 34 35 |
# File 'lib/audit_logger.rb', line 33 def audit_with_resque(block_name, log_exception_only: false, do_raise: false, &block) audit(block_name, log_exception_only: log_exception_only, do_raise: do_raise, &block) end |