Class: AuditLogger::Audit

Inherits:
Logger
  • Object
show all
Includes:
AuditMessageStyles
Defined in:
lib/audit_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_pidObject (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_severityObject (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_ageObject (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_sizeObject (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_threadObject (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_timestampObject (readonly)

Returns the value of attribute al_timestamp.



11
12
13
# File 'lib/audit_logger.rb', line 11

def al_timestamp
  @al_timestamp
end

#log_file_nameObject (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