Class: CarrotRpc::TaggedLog
- Inherits:
-
Object
- Object
- CarrotRpc::TaggedLog
- Defined in:
- lib/carrot_rpc/tagged_log.rb
Overview
Wrap the Logger object with convenience methods.
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Instance Method Summary collapse
-
#initialize(logger:, tags:) ⇒ TaggedLog
constructor
A new instance of TaggedLog.
- #level ⇒ Object
- #level=(level) ⇒ Object
- #with_correlation_id(correlation_id, &block) ⇒ Object
Constructor Details
#initialize(logger:, tags:) ⇒ TaggedLog
Returns a new instance of TaggedLog.
5 6 7 8 |
# File 'lib/carrot_rpc/tagged_log.rb', line 5 def initialize(logger:, tags:) @logger = logger @tags = * end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
3 4 5 |
# File 'lib/carrot_rpc/tagged_log.rb', line 3 def logger @logger end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
3 4 5 |
# File 'lib/carrot_rpc/tagged_log.rb', line 3 def @tags end |
Instance Method Details
#level ⇒ Object
10 11 12 |
# File 'lib/carrot_rpc/tagged_log.rb', line 10 def level logger.level end |
#level=(level) ⇒ Object
14 15 16 |
# File 'lib/carrot_rpc/tagged_log.rb', line 14 def level=(level) logger.level = level end |
#with_correlation_id(correlation_id, &block) ⇒ Object
27 28 29 |
# File 'lib/carrot_rpc/tagged_log.rb', line 27 def with_correlation_id(correlation_id, &block) tagged("correlation_id=#{correlation_id}", &block) end |