Class: F4w::Logging::Entry
- Inherits:
-
Object
- Object
- F4w::Logging::Entry
- Defined in:
- lib/f4w/logging/entry.rb
Constant Summary collapse
- VERSION =
1
Instance Attribute Summary collapse
-
#app_data_log_record ⇒ Object
Returns the value of attribute app_data_log_record.
-
#error_log_record ⇒ Object
Returns the value of attribute error_log_record.
-
#invocation_zoned_date_time ⇒ Object
Returns the value of attribute invocation_zoned_date_time.
-
#service_uri ⇒ Object
Returns the value of attribute service_uri.
-
#type_of_call ⇒ Object
Returns the value of attribute type_of_call.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Class Method Summary collapse
- .error(uri, user_id, error_context, error_message, data = nil) ⇒ Object
- .request_end(uri, user_id, data = nil) ⇒ Object
- .request_start(uri, user_id, data = nil) ⇒ Object
Instance Method Summary collapse
- #as_json(options = nil) ⇒ Object
-
#initialize(uri, type_of_call, user_id, app_data, error_data) ⇒ Entry
constructor
A new instance of Entry.
- #to_s ⇒ Object
Constructor Details
#initialize(uri, type_of_call, user_id, app_data, error_data) ⇒ Entry
Returns a new instance of Entry.
17 18 19 20 21 22 23 24 25 |
# File 'lib/f4w/logging/entry.rb', line 17 def initialize(uri, type_of_call, user_id, app_data, error_data) @service_uri = uri @type_of_call = type_of_call @app_data_log_record = app_data @error_log_record = error_data @user_id = user_id @invocation_zoned_date_time = DateTime.now.iso8601(3) end |
Instance Attribute Details
#app_data_log_record ⇒ Object
Returns the value of attribute app_data_log_record.
10 11 12 |
# File 'lib/f4w/logging/entry.rb', line 10 def app_data_log_record @app_data_log_record end |
#error_log_record ⇒ Object
Returns the value of attribute error_log_record.
11 12 13 |
# File 'lib/f4w/logging/entry.rb', line 11 def error_log_record @error_log_record end |
#invocation_zoned_date_time ⇒ Object
Returns the value of attribute invocation_zoned_date_time.
12 13 14 |
# File 'lib/f4w/logging/entry.rb', line 12 def invocation_zoned_date_time @invocation_zoned_date_time end |
#service_uri ⇒ Object
Returns the value of attribute service_uri.
13 14 15 |
# File 'lib/f4w/logging/entry.rb', line 13 def service_uri @service_uri end |
#type_of_call ⇒ Object
Returns the value of attribute type_of_call.
14 15 16 |
# File 'lib/f4w/logging/entry.rb', line 14 def type_of_call @type_of_call end |
#user_id ⇒ Object
Returns the value of attribute user_id.
15 16 17 |
# File 'lib/f4w/logging/entry.rb', line 15 def user_id @user_id end |
Class Method Details
.error(uri, user_id, error_context, error_message, data = nil) ⇒ Object
49 50 51 |
# File 'lib/f4w/logging/entry.rb', line 49 def self.error(uri, user_id, error_context, , data = nil) log_request(uri, '-1', user_id, data, error_context, ) end |
.request_end(uri, user_id, data = nil) ⇒ Object
45 46 47 |
# File 'lib/f4w/logging/entry.rb', line 45 def self.request_end(uri, user_id, data = nil) log_request(uri, '2', user_id, data) end |
.request_start(uri, user_id, data = nil) ⇒ Object
41 42 43 |
# File 'lib/f4w/logging/entry.rb', line 41 def self.request_start(uri, user_id, data = nil) log_request(uri, '1', user_id, data) end |
Instance Method Details
#as_json(options = nil) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/f4w/logging/entry.rb', line 27 def as_json( = nil) json = { 'invocationZonedDateTime' => @invocation_zoned_date_time, 'serviceURI' => @service_uri, 'tyepeOfCall' => @type_of_call } json['appDataLogRecord'] = @app_data_log_record.as_json() unless @app_data_log_record.nil? json['errorLogRecord'] = @error_log_record.as_json() unless @error_log_record.nil? json['userID'] = @user_id unless @user_id.nil? json end |
#to_s ⇒ Object
53 54 55 |
# File 'lib/f4w/logging/entry.rb', line 53 def to_s "ver=#{VERSION} log=#{to_json}" end |