Module: QuietLogger::Tagging Private

Defined in:
lib/quiet_logger.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Delegates the tagged logging API to the wrapped logger. This is only mixed into instances that wrap a logger which supports tagging so that respond_to?(:tagged) continues to advertise what the wrapped logger can actually do.

Instance Method Summary collapse

Instance Method Details

#clear_tags!Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



67
68
69
# File 'lib/quiet_logger.rb', line 67

def clear_tags!
  @logger.clear_tags!
end

#pop_tags(count = 1) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



63
64
65
# File 'lib/quiet_logger.rb', line 63

def pop_tags(count = 1)
  @logger.pop_tags(count)
end

#push_tags(*tags) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



59
60
61
# File 'lib/quiet_logger.rb', line 59

def push_tags(*tags)
  @logger.push_tags(*tags)
end

#tagged(*tags) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add tags to the messages logged inside the block. Tags are stored on the wrapped logger, so they are applied to messages logged with either logger.



51
52
53
54
55
56
57
# File 'lib/quiet_logger.rb', line 51

def tagged(*tags)
  if block_given?
    @logger.tagged(*tags) { yield self }
  else
    self.class.new(@logger.tagged(*tags), level: @level)
  end
end