Class Cabin::Outputs::IO
In: lib/cabin/outputs/io.rb
lib/cabin/outputs/io.rb
Parent: Object

Wrap IO objects with a reasonable log output.

If the IO is not attached to a tty (io#tty? returns false), then the event will be written in ruby inspect format terminated by a newline:

    { "timestamp" => ..., "message" => message, ... }

If the IO is attached to a TTY, there are # human-friendly in this format:

    message { event data }

Additionally, colorized output may be available. If the event has :level, :color, or :bold. Any of the Cabin::Mixins::Logger methods (info, error, etc) will result in colored output. See the LEVELMAP for the mapping of levels to colors.

Methods

<<   <<   new   new   tty?   tty?  

Constants

CODEMAP = { :normal => 0, :bold => 1, :black => 30, :red => 31, :green => 32, :yellow => 33, :blue => 34, :magenta => 35, :cyan => 36, :white => 37   Mapping of color/style names to ANSI control values
LEVELMAP = { :fatal => :red, :error => :red, :warn => :yellow, :info => :green, # default color :debug => :cyan, }   Map of log levels to colors
CODEMAP = { :normal => 0, :bold => 1, :black => 30, :red => 31, :green => 32, :yellow => 33, :blue => 34, :magenta => 35, :cyan => 36, :white => 37   Mapping of color/style names to ANSI control values
LEVELMAP = { :fatal => :red, :error => :red, :warn => :yellow, :info => :green, # default color :debug => :cyan, }   Map of log levels to colors

Public Class methods

Public Instance methods

Receive an event

Receive an event

[Validate]