Class: AuditStream
- Inherits:
-
Object
- Object
- AuditStream
- Defined in:
- lib/tdl/audit/audit_stream.rb
Instance Method Summary collapse
- #end_line ⇒ Object
-
#initialize ⇒ AuditStream
constructor
A new instance of AuditStream.
- #log_request(request) ⇒ Object
- #log_response(response) ⇒ Object
- #start_line ⇒ Object
Constructor Details
#initialize ⇒ AuditStream
Returns a new instance of AuditStream.
2 3 4 5 |
# File 'lib/tdl/audit/audit_stream.rb', line 2 def initialize @logger = Logging.logger[self] start_line end |
Instance Method Details
#end_line ⇒ Object
35 36 37 |
# File 'lib/tdl/audit/audit_stream.rb', line 35 def end_line @logger.info @str end |
#log_request(request) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/tdl/audit/audit_stream.rb', line 11 def log_request(request) params_as_string = TDL::PresentationUtil.to_displayable_request(request.params) text = "id = #{request.id}, req = #{request.method}(#{params_as_string})" if not text.empty? and @str.length > 0 @str << ', ' end @str << text end |
#log_response(response) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/tdl/audit/audit_stream.rb', line 21 def log_response(response) if response.instance_variable_defined?(:@result) representation = TDL::PresentationUtil.to_displayable_response(response.result) text = "resp = #{representation}" else text = "error = #{response.}" + ", (NOT PUBLISHED)" end if not text.empty? and @str.length > 0 @str << ', ' end @str << text end |
#start_line ⇒ Object
7 8 9 |
# File 'lib/tdl/audit/audit_stream.rb', line 7 def start_line @str = '' end |