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

Instance Attribute Summary

Attributes inherited from Base

#log, #log_application, #log_environment, #log_host, #logger, #precision, #time_format

Instance Method Summary collapse

Methods inherited from Default

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

Methods inherited from Base

build_time_format, #initialize, #pid, #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