Class: Yell::Adapters::Io

Inherits:
Base
  • Object
show all
Includes:
Formatter::Helpers
Defined in:
lib/yell/adapters/io.rb

Direct Known Subclasses

File, Stderr, Stdout

Constant Summary collapse

Colors =

The possible unix log colors

{
  0   => "\e[32;1m",  # green;bold
  # 1   => "\e[0m",     # white
  2   => "\e[33;1m",  # yello;bold
  3   => "\e[31;1m",  # red;bold
  4   => "\e[35;1m",  # magenta;bold
  5   => "\e[36m",    # cyan
  -1  => "\e[0m"      # NONE
}

Instance Attribute Summary collapse

Attributes included from Formatter::Helpers

#format

Attributes included from Level::Helpers

#level

Instance Method Summary collapse

Methods inherited from Base

close, #close, #initialize, #inspect, open, setup, write, #write

Constructor Details

This class inherits a constructor from Yell::Adapters::Base

Instance Attribute Details

#colorsObject

Sets colored output on or off (default off)

Examples:

Enable colors

colors = true

Disable colors

colors = false


71
72
73
# File 'lib/yell/adapters/io.rb', line 71

def colors
  @colors
end

#syncObject

Sets the “sync mode” to true or false.

When true (default), every log event is immediately written to the file. When false, the log event is buffered internally.



62
63
64
# File 'lib/yell/adapters/io.rb', line 62

def sync
  @sync
end

Instance Method Details

#colorize!Object

Shortcut to enable colors.

Examples:

colorize!


77
# File 'lib/yell/adapters/io.rb', line 77

def colorize!; @colors = true; end