lib/semantic_logger/base.rb in semantic_logger-2.2.0 vs lib/semantic_logger/base.rb in semantic_logger-2.3.0
- old
+ new
@@ -159,25 +159,23 @@
alias_method :with_tags, :tagged
# Returns [Array] of [String] tags currently active for this thread
# Returns nil if no tags are set
def tags
- Thread.current[:semantic_logger_tags]
+ Thread.current[:semantic_logger_tags] ||= []
end
# Add tags to the current scope
# To support: ActiveSupport::TaggedLogging V4 and above
def push_tags *tags
# Check for nil tags
- Thread.current[:semantic_logger_tags] = (self.tags || []) + tags if tags
+ Thread.current[:semantic_logger_tags] = self.tags.concat(tags)
end
# Remove specified number of tags from the current tag list
# To support: ActiveSupport::TaggedLogging V4 and above
- def pop_tags(quantity)
- if tags = self.tags
- Thread.current[:semantic_logger_tags] = tags.pop(quantity)
- end
+ def pop_tags(quantity=1)
+ tags.pop(quantity)
end
# Thread specific context information to be logged with every log entry
#
# Add a payload to all log calls on This Thread within the supplied block