Class: SemanticLogger::Formatters::Short
- Inherits:
-
Default
- Object
- Default
- SemanticLogger::Formatters::Short
- Defined in:
- lib/semantic_logger/formatters/short.rb
Constant Summary collapse
- TAGS_TO_REMOVE =
[:pact_broker_git_sha, :tenant_id, :request_id, :pactflow_git_sha]
Instance Method Summary collapse
Instance Method Details
#call(log, logger) ⇒ Object
8 9 10 11 12 13 |
# File 'lib/semantic_logger/formatters/short.rb', line 8 def call(log, logger) self.log = log self.logger = logger [time, level, , , duration, , payload, exception].compact.join(" ") end |
#named_tags ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/semantic_logger/formatters/short.rb', line 19 def = log..reject{ | k, _ | TAGS_TO_REMOVE.include?(k) } return if .nil? || .empty? list = [] .each_pair { |name, value| list << "#{name}: #{value}" } "{#{list.join(', ')}}" end |
#time ⇒ Object
15 16 17 |
# File 'lib/semantic_logger/formatters/short.rb', line 15 def time log.time.strftime("%H:%M:%S") end |