Class: Yell::Adapters::Io
Constant Summary collapse
- Colors =
The possible unix log colors
{ 'DEBUG' => "\e[32;1m", # green;bold # 'INFO' => "\e[0m", # white 'WARN' => "\e[33;1m", # yello;bold 'ERROR' => "\e[31;1m", # red;bold 'FATAL' => "\e[35;1m", # magenta;bold 'UNKNOWN' => "\e[36m", # cyan 'DEFAULT' => "\e[0m" # NONE }
Instance Attribute Summary collapse
-
#format ⇒ Object
Accessor to the formatter.
Attributes inherited from Base
Instance Method Summary collapse
-
#close ⇒ Object
Close the io stream.
-
#colorize(color = true) ⇒ Object
(also: #colorize!)
Enable colorizing the log output.
-
#initialize(options = {}, &block) ⇒ Io
constructor
A new instance of Io.
-
#stream ⇒ Object
The IO stream.
Methods inherited from Base
Constructor Details
#initialize(options = {}, &block) ⇒ Io
Returns a new instance of Io.
22 23 24 25 26 27 28 |
# File 'lib/yell/adapters/io.rb', line 22 def initialize( = {}, &block ) colorize .fetch(:colorize, false) self.format = [:format] super( , &block ) end |
Instance Attribute Details
#format ⇒ Object
Accessor to the formatter
20 21 22 |
# File 'lib/yell/adapters/io.rb', line 20 def format @format end |
Instance Method Details
#close ⇒ Object
Close the io stream
39 40 41 42 43 |
# File 'lib/yell/adapters/io.rb', line 39 def close @stream.close if @stream.respond_to? :close @stream = nil end |
#colorize(color = true) ⇒ Object Also known as: colorize!
Enable colorizing the log output.
55 56 57 |
# File 'lib/yell/adapters/io.rb', line 55 def colorize( color = true ) @colorize = color end |
#stream ⇒ Object
The IO stream
Adapter classes should provide their own implementation of this method.
34 35 36 |
# File 'lib/yell/adapters/io.rb', line 34 def stream raise 'Not implemented' end |