class Puma::LogWriter
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/puma/log_writer.rbs class Puma::LogWriter def debug?: () -> false def internal_write: (String str) -> nil def log: (String str) -> nil end
(stdout
) and errors (stderr
).
Handles logging concerns for both standard messages
def self.null
def self.null n = NullIO.new LogWriter.new(n, n) end
def self.stdio
def self.stdio LogWriter.new($stdout, $stderr) end
def self.strings
Returns an LogWriter object which writes its status to
def self.strings LogWriter.new(StringIO.new, StringIO.new) end
def connection_error(error, req, text="HTTP connection error")
- Version: - 5.0.0
def connection_error(error, req, text="HTTP connection error") @error_logger.info(error: error, req: req, text: text) end
def debug(str)
def debug(str) log("% #{str}") if @debug end
def debug?
Experimental RBS support (using type sampling data from the type_fusion
project).
def debug?: () -> false
This signature was generated using 1 sample from 1 application.
def debug? @debug end
def debug_error(error, req=nil, text="")
- Version: - 5.0.0
def debug_error(error, req=nil, text="") @error_logger.debug(error: error, req: req, text: text) end
def error(str)
def error(str) @error_logger.info(text: @formatter.call("ERROR: #{str}")) exit 1 end
def format(str)
def format(str) formatter.call(str) end
def initialize(stdout, stderr)
def initialize(stdout, stderr) @formatter = DefaultFormatter.new @custom_logger = nil @stdout = stdout @stderr = stderr @debug = ENV.key?('PUMA_DEBUG') @error_logger = ErrorLogger.new(@stderr) end
def internal_write(str)
Experimental RBS support (using type sampling data from the type_fusion
project).
def internal_write: (String str) -> nil
This signature was generated using 1 sample from 1 application.
def internal_write(str) LOG_QUEUE << str while (w_str = LOG_QUEUE.pop(true)) do begin @stdout.is_a?(IO) and @stdout.wait_writable(1) @stdout.write w_str @stdout.flush unless @stdout.sync rescue Errno::EPIPE, Errno::EBADF, IOError, Errno::EINVAL # 'Invalid argument' (Errno::EINVAL) may be raised by flush end end rescue ThreadError end
def log(str)
Experimental RBS support (using type sampling data from the type_fusion
project).
def log: (String str) -> nil
This signature was generated using 1 sample from 1 application.
def log(str) if @custom_logger&.respond_to?(:write) @custom_logger.write(format(str)) else internal_write "#{@formatter.call str}\n" end end
def parse_error(error, req)
+error+ a parsing exception,
An HTTP parse error has occurred.
def parse_error(error, req) @error_logger.info(error: error, req: req, text: 'HTTP parse error, malformed request') end
def ssl_error(error, ssl_socket)
-
ssl_socket
(Puma::MiniSSL::Socket
) -- -
error
(Puma::MiniSSL::SSLError
) --
def ssl_error(error, ssl_socket) peeraddr = ssl_socket.peeraddr.last rescue "<unknown>" peercert = ssl_socket.peercert subject = peercert&.subject @error_logger.info(error: error, text: "SSL error, peer: #{peeraddr}, peer cert: #{subject}") end
def unknown_error(error, req=nil, text="Unknown error")
+error+ an exception object, +req+ the request,
An unknown error has occurred.
def unknown_error(error, req=nil, text="Unknown error") @error_logger.info(error: error, req: req, text: text) end
def write(str)
def write(str) internal_write @formatter.call(str) end