Module: Raptor::Log

Defined in:
lib/raptor/log.rb

Overview

Shared logging helpers. Every line is prefixed with ‘[Raptor <pid>|<ractor>|<thread>]` so output is identifiable and traceable to its source in a mixed log stream.

Class Method Summary collapse

Class Method Details

.info(message) ⇒ void

This method returns an undefined value.

Writes an informational message to stdout.

Parameters:

  • message (String)

    the message to log



16
17
18
# File 'lib/raptor/log.rb', line 16

def self.info(message)
  Kernel.puts "#{prefix} #{message}"
end

.rescued_error(error) ⇒ void

This method returns an undefined value.

Logs a rescued exception to stderr. The full message (class, message, backtrace) is written on subsequent unprefixed lines.

Parameters:

  • error (Exception)

    the rescued exception



37
38
39
40
# File 'lib/raptor/log.rb', line 37

def self.rescued_error(error)
  Kernel.warn "#{prefix} rescued:"
  Kernel.warn error.full_message
end

.warn(message) ⇒ void

This method returns an undefined value.

Writes a warning to stderr.

Parameters:

  • message (String)

    the message to log



26
27
28
# File 'lib/raptor/log.rb', line 26

def self.warn(message)
  Kernel.warn "#{prefix} #{message}"
end