Sha256: 28209c0b0bfa1e3f2c8436145c145c26191a96b5a9273787d2a7ef985b31a46a

Contents?: true

Size: 798 Bytes

Versions: 8

Compression:

Stored size: 798 Bytes

Contents

require "glib2"

require "rabbit/logger/base"

module Rabbit
  module Logger
    class STDERR
      include Base

      private
      def do_log(severity, prog_name, message)
        begin
          message = message.encode("locale")
        rescue EncodingError
          format = _("can't convert to current locale from UTF-8: %s")
          sanitized_message = message.encode(format.encoding,
                                             :invalid => :replace,
                                             :undef   => :replace)
          $stderr.puts(format % sanitized_message)
        end
        $stderr.puts(format_severity(severity))
        $stderr.print("[#{prog_name}]: ") if prog_name
        $stderr.puts(message)
        exit if severity >= Severity::FATAL
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rabbit-2.2.1 lib/rabbit/logger/stderr.rb
rabbit-2.2.0 lib/rabbit/logger/stderr.rb
rabbit-2.1.9 lib/rabbit/logger/stderr.rb
rabbit-2.1.8 lib/rabbit/logger/stderr.rb
rabbit-2.1.7 lib/rabbit/logger/stderr.rb
rabbit-2.1.6 lib/rabbit/logger/stderr.rb
rabbit-2.1.5 lib/rabbit/logger/stderr.rb
rabbit-2.1.4 lib/rabbit/logger/stderr.rb