Class: CMDx::LogFormatters::Raw

Inherits:
Object
  • Object
show all
Defined in:
lib/cmdx/log_formatters/raw.rb

Overview

Formats log messages as raw text without additional formatting

This formatter outputs log messages in their original form with minimal processing, adding only a trailing newline. It’s useful for scenarios where you want to preserve the exact message content without metadata or structured formatting.

Instance Method Summary collapse

Instance Method Details

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

Formats a log entry as raw text

Examples:

Basic usage

logger_formatter.call("INFO", Time.now, "MyApp", "User logged in")
# => "User logged in\n"

Parameters:

  • severity (String)

    The log level (e.g., “INFO”, “ERROR”, “DEBUG”)

  • time (Time)

    The timestamp when the log entry was created

  • progname (String, nil)

    The program name or identifier

  • message (Object)

    The log message content

Returns:

  • (String)

    The raw message with a trailing newline



27
28
29
# File 'lib/cmdx/log_formatters/raw.rb', line 27

def call(severity, time, progname, message)
  "#{message}\n"
end