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.
13
14
15
16
17
|
# File 'lib/lumberjack/tagged_logger_support.rb', line 13
def initialize(formatter:, logger:)
@logger = logger
@formatter = formatter
super(formatter)
end
|
Instance Method Details
35
36
37
|
# File 'lib/lumberjack/tagged_logger_support.rb', line 35
def __formatter
@formatter
end
|
19
20
21
22
23
24
25
26
|
# File 'lib/lumberjack/tagged_logger_support.rb', line 19
def current_tags
tags = @logger.instance_variable_get(:@tags)
if tags.is_a?(Hash)
Array(tags["tagged"])
else
[]
end
end
|
#tags_text ⇒ Object
28
29
30
31
32
33
|
# File 'lib/lumberjack/tagged_logger_support.rb', line 28
def tags_text
tags = current_tags
if tags.any?
tags.collect { |tag| "[#{tag}] " }.join
end
end
|