Class: Lumberjack::TaggedLoggerSupport::Formatter
- Inherits:
-
Formatter
- Object
- Formatter
- Lumberjack::TaggedLoggerSupport::Formatter
show all
- Extended by:
- Forwardable
- Defined in:
- lib/lumberjack/tagged_logger_support.rb
Instance Method Summary
collapse
Methods inherited from Formatter
#add, #call, #clear, empty, #format, #remove
Constructor Details
#initialize(formatter:, logger:) ⇒ Formatter
Returns a new instance of Formatter.
14
15
16
17
18
|
# File 'lib/lumberjack/tagged_logger_support.rb', line 14
def initialize(formatter:, logger:)
@logger = logger
@formatter = formatter
super(formatter)
end
|
Instance Method Details
36
37
38
|
# File 'lib/lumberjack/tagged_logger_support.rb', line 36
def __formatter
@formatter
end
|
20
21
22
23
24
25
26
27
|
# File 'lib/lumberjack/tagged_logger_support.rb', line 20
def current_tags
tags = @logger.instance_variable_get(:@tags)
if tags.is_a?(Hash)
Array(tags["tagged"])
else
[]
end
end
|
#tags_text ⇒ Object
29
30
31
32
33
34
|
# File 'lib/lumberjack/tagged_logger_support.rb', line 29
def tags_text
tags = current_tags
if tags.any?
tags.collect { |tag| "[#{tag}] " }.join
end
end
|