Class: TermsOfUse::Logger
- Inherits:
-
Object
- Object
- TermsOfUse::Logger
- Defined in:
- app/services/terms_of_use/logger.rb
Constant Summary collapse
- STATSD_PREFIX =
'api.terms_of_use_agreements'
Instance Attribute Summary collapse
-
#terms_of_use_agreement ⇒ Object
readonly
private
Returns the value of attribute terms_of_use_agreement.
Instance Method Summary collapse
- #context ⇒ Object private
- #increment_terms_of_use_agreement_statsd ⇒ Object private
-
#initialize(terms_of_use_agreement:) ⇒ Logger
constructor
A new instance of Logger.
- #log_terms_of_use_agreement ⇒ Object private
- #perform ⇒ Object
- #prefix ⇒ Object private
- #user_account ⇒ Object private
Constructor Details
#initialize(terms_of_use_agreement:) ⇒ Logger
Returns a new instance of Logger.
7 8 9 |
# File 'app/services/terms_of_use/logger.rb', line 7 def initialize(terms_of_use_agreement:) @terms_of_use_agreement = terms_of_use_agreement end |
Instance Attribute Details
#terms_of_use_agreement ⇒ Object (readonly, private)
Returns the value of attribute terms_of_use_agreement.
18 19 20 |
# File 'app/services/terms_of_use/logger.rb', line 18 def terms_of_use_agreement @terms_of_use_agreement end |
Instance Method Details
#context ⇒ Object (private)
33 34 35 36 37 38 39 40 41 |
# File 'app/services/terms_of_use/logger.rb', line 33 def context @context ||= { terms_of_use_agreement_id: terms_of_use_agreement.id, user_account_uuid: user_account.id, icn: user_account.icn, agreement_version: terms_of_use_agreement.agreement_version, response: terms_of_use_agreement.response } end |
#increment_terms_of_use_agreement_statsd ⇒ Object (private)
24 25 26 27 |
# File 'app/services/terms_of_use/logger.rb', line 24 def increment_terms_of_use_agreement_statsd StatsD.increment("#{STATSD_PREFIX}.#{prefix}", tags: ["version:#{terms_of_use_agreement.agreement_version}"]) end |
#log_terms_of_use_agreement ⇒ Object (private)
20 21 22 |
# File 'app/services/terms_of_use/logger.rb', line 20 def log_terms_of_use_agreement Rails.logger.info("[TermsOfUseAgreement] [#{prefix.capitalize}]", context) end |
#perform ⇒ Object
11 12 13 14 |
# File 'app/services/terms_of_use/logger.rb', line 11 def perform log_terms_of_use_agreement increment_terms_of_use_agreement_statsd end |
#prefix ⇒ Object (private)
29 30 31 |
# File 'app/services/terms_of_use/logger.rb', line 29 def prefix @prefix ||= terms_of_use_agreement.response end |
#user_account ⇒ Object (private)
43 44 45 |
# File 'app/services/terms_of_use/logger.rb', line 43 def user_account @user_account ||= terms_of_use_agreement.user_account end |