PHP 8.2.31
Preview: formatter.rb Size: 796 B
/proc/thread-self/root/opt/alt/ruby31/share/ruby/logger/formatter.rb

# frozen_string_literal: true

class Logger
  # Default formatter for log messages.
  class Formatter
    Format = "%s, [%s #%d] %5s -- %s: %s\n"
    DatetimeFormat = "%Y-%m-%dT%H:%M:%S.%6N"

    attr_accessor :datetime_format

    def initialize
      @datetime_format = nil
    end

    def call(severity, time, progname, msg)
      Format % [severity[0..0], format_datetime(time), Process.pid, severity, progname,
        msg2str(msg)]
    end

  private

    def format_datetime(time)
      time.strftime(@datetime_format || DatetimeFormat)
    end

    def msg2str(msg)
      case msg
      when ::String
        msg
      when ::Exception
        "#{ msg.message } (#{ msg.class })\n#{ msg.backtrace.join("\n") if msg.backtrace }"
      else
        msg.inspect
      end
    end
  end
end

Directory Contents

Dirs: 0 × Files: 6

Name Size Perms Modified Actions
180 B lrw-r--r-- 2025-04-28 17:36:06
Edit Download
796 B lrw-r--r-- 2025-04-28 17:36:06
Edit Download
5.56 KB lrw-r--r-- 2025-04-28 17:36:06
Edit Download
1.41 KB lrw-r--r-- 2025-04-28 17:36:06
Edit Download
458 B lrw-r--r-- 2025-04-28 17:36:06
Edit Download
68 B lrw-r--r-- 2025-04-28 17:36:06
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).