Class: SemanticLogger::Formatters::OneLine

Inherits:
Default
  • Object
show all
Defined in:
lib/semantic_logger/formatters/one_line.rb

Overview

Only output one line for each log entry.

Notes:

  • New lines are stripped from log messages.

  • Exceptions only include the class and message, the stack trace is not shown.

Constant Summary

Constants inherited from Base

Base::PRECISION, Base::TIME_FORMAT

Instance Attribute Summary

Attributes inherited from Default

#log, #logger

Attributes inherited from Base

#log_application, #log_host, #time_format

Instance Method Summary collapse

Methods inherited from Default

#call, #duration, #level, #name, #named_tags, #payload, #process_info, #tags

Methods inherited from Base

#initialize, #time

Constructor Details

This class inherits a constructor from SemanticLogger::Formatters::Base

Instance Method Details

#exceptionObject



13
14
15
# File 'lib/semantic_logger/formatters/one_line.rb', line 13

def exception
  "-- Exception: #{log.exception.class}: #{log.exception.message.delete("\n")}" if log.exception
end

#messageObject



9
10
11
# File 'lib/semantic_logger/formatters/one_line.rb', line 9

def message
  "-- #{log.message.delete("\n")}" if log.message
end