Class: Kino::Logger

Inherits:
Logger
  • Object
show all
Defined in:
lib/kino/logger.rb

Overview

A ::Logger writing through the native async sink: formatted lines go onto a lock-free channel and a Rust flusher thread batches them into the output: no per-line mutex (which serializes every worker thread) and no write syscall on request threads.

# e.g. Rails, config/environments/production.rb: config.logger = Kino::Logger.new # stdout config.logger = Kino::Logger.new("log/production.log")

Durability: a graceful shutdown drains everything; a hard crash can lose the tail of the buffer (the standard async-logging trade-off).

Defined Under Namespace

Classes: Device

Instance Method Summary collapse

Constructor Details

#initialize(path = nil, **options) ⇒ Logger

Returns a new instance of Logger.

Parameters:

  • path (String, nil) (defaults to: nil)

    log file path (created/appended), or nil for stdout

  • options (Hash)

    passed through to ::Logger#initialize (progname:, level:, formatter:, ...)



22
23
24
# File 'lib/kino/logger.rb', line 22

def initialize(path = nil, **options)
  super(Device.new(path), **options)
end