Class: PryAuditlog::Logger
- Inherits:
-
Object
- Object
- PryAuditlog::Logger
- Defined in:
- lib/pry-auditlog/logger.rb
Class Attribute Summary collapse
-
.audit_file ⇒ Object
Returns the value of attribute audit_file.
-
.prompt ⇒ Object
Returns the value of attribute prompt.
-
.session_token ⇒ Object
Returns the value of attribute session_token.
Class Method Summary collapse
Class Attribute Details
.audit_file ⇒ Object
Returns the value of attribute audit_file.
4 5 6 |
# File 'lib/pry-auditlog/logger.rb', line 4 def audit_file @audit_file end |
.prompt ⇒ Object
Returns the value of attribute prompt.
4 5 6 |
# File 'lib/pry-auditlog/logger.rb', line 4 def prompt @prompt end |
.session_token ⇒ Object
Returns the value of attribute session_token.
4 5 6 |
# File 'lib/pry-auditlog/logger.rb', line 4 def session_token @session_token end |
Class Method Details
.log(type, line) ⇒ Object
19 20 21 22 23 |
# File 'lib/pry-auditlog/logger.rb', line 19 def self.log(type, line) line = "#{@prompt}#{line}" if type == 'I' log_line = "[#{Time.now}][#{@session_token}][#{type}] #{line}" @audit_file.puts log_line if @audit_file && !line.strip.empty? end |