Class: Shoryuken::Logging::Pretty

Inherits:
Base
  • Object
show all
Defined in:
lib/shoryuken/logging/pretty.rb

Overview

A pretty log formatter that includes timestamps, process ID, thread ID, context information, and severity in a human-readable format.

Output format: “TIMESTAMP PID TID-THREAD_ID CONTEXT SEVERITY: MESSAGE”

Examples:

Output

2023-08-15T10:30:45Z 12345 TID-abc123 MyWorker/queue1/msg-456 INFO: Processing message

Instance Method Summary collapse

Methods inherited from Base

#context, #tid

Instance Method Details

#call(severity, time, _program_name, message) ⇒ String

Formats a log message with timestamp and full context information.

Parameters:

  • severity (String)

    Log severity level (DEBUG, INFO, WARN, ERROR, FATAL)

  • time (Time)

    Timestamp when the log entry was created

  • _program_name (String)

    Program name (unused)

  • message (String)

    The log message

Returns:

  • (String)

    Formatted log entry with newline



20
21
22
# File 'lib/shoryuken/logging/pretty.rb', line 20

def call(severity, time, _program_name, message)
  "#{time.utc.iso8601} #{Process.pid} TID-#{tid}#{context} #{severity}: #{message}\n"
end