Class: Nexaas::Auditor::AuditLogger
- Inherits:
-
Object
- Object
- Nexaas::Auditor::AuditLogger
- Defined in:
- lib/nexaas/auditor/audit_logger.rb
Constant Summary collapse
- VALID_LEVELS =
%w(degug info warn error fatal)
Instance Attribute Summary collapse
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize(logger = nil) ⇒ AuditLogger
constructor
A new instance of AuditLogger.
- #log(options = {}) ⇒ Object
Constructor Details
#initialize(logger = nil) ⇒ AuditLogger
Returns a new instance of AuditLogger.
9 10 11 |
# File 'lib/nexaas/auditor/audit_logger.rb', line 9 def initialize(logger=nil) @logger = logger end |
Instance Attribute Details
#logger ⇒ Object
Returns the value of attribute logger.
7 8 9 |
# File 'lib/nexaas/auditor/audit_logger.rb', line 7 def logger @logger end |
Instance Method Details
#log(options = {}) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/nexaas/auditor/audit_logger.rb', line 17 def log(={}) level = .delete(:level) raise ArgumentError, "required key `:level` not found" if level.nil? raise ArgumentError, "key `:level` is invalid: '#{level}'" unless VALID_LEVELS.include?(level.to_s) () safe_call { logger.send(level, ()) } end |