Class: AuditStream

Inherits:
Object
  • Object
show all
Defined in:
lib/tdl/audit/audit_stream.rb

Instance Method Summary collapse

Constructor Details

#initializeAuditStream

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_lineObject



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.message}" + ", (NOT PUBLISHED)"
  end

  if not text.empty? and @str.length > 0
    @str << ', '
  end
  @str << text
end

#start_lineObject



7
8
9
# File 'lib/tdl/audit/audit_stream.rb', line 7

def start_line
  @str = ''
end