Class: Yell::Adapters::Io

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

Direct Known Subclasses

File, Stderr, Stdout

Constant Summary collapse

TTYColors =

The possible unix log colors

{
  0   => "\033[1;32m",  # green
  1   => "\033[0m",     # normal
  2   => "\033[1;33m",  # yellow
  3   => "\033[1;31m",  # red
  4   => "\033[1;35m",  # magenta
  5   => "\033[1;36m",  # cyan
  -1  => "\033[0m"      # normal
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::Formatter

#formatter, #formatter=

Methods inherited from Base

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

Methods included from Helpers::Level

#level, #level=

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


30
31
32
# File 'lib/yell/adapters/io.rb', line 30

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.



21
22
23
# File 'lib/yell/adapters/io.rb', line 21

def sync
  @sync
end

Instance Method Details

#colorize!Object

Shortcut to enable colors.

Examples:

colorize!


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

def colorize!; @colors = true; end