Class: LanguageOperator::CLI::Formatters::LogFormatter

Inherits:
Object
  • Object
show all
Extended by:
Helpers::UxHelper
Defined in:
lib/language_operator/cli/formatters/log_formatter.rb

Overview

Formatter for displaying agent execution logs with color and icons

Class Method Summary collapse

Methods included from Helpers::UxHelper

box, highlight_ruby_code, logo, pastel, prompt, spinner, table

Class Method Details

.format_line(line) ⇒ String

Format a single log line from kubectl output

Parameters:

  • Raw log line from kubectl (with [pod/container] prefix)

Returns:

  • Formatted log line with colors and icons



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/language_operator/cli/formatters/log_formatter.rb', line 21

def format_line(line)
  return line if line.strip.empty?

  # Parse kubectl prefix: [pod-name/container-name] log_content
  prefix, content = parse_kubectl_prefix(line)

  # Format the log content based on detected format
  formatted_content = format_log_content(content)

  # Combine with dimmed prefix
  if prefix
    "#{pastel.dim(prefix)} #{formatted_content}"
  else
    formatted_content
  end
end