The possible unix log colors
Sets colored output on or off (default off)
@example Enable colors
colors = true
@example Disable colors
colors = false
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.
Shortcut to enable colors.
@example
colorize!
# File lib/yell/adapters/io.rb, line 37 def colorize!; @colors = true; end
@overload close!
# File lib/yell/adapters/io.rb, line 76 def close! @stream.close if @stream.respond_to?(:close) @stream = nil super end
@overload inspectables
# File lib/yell/adapters/io.rb, line 92 def inspectables super.concat [:formatter, :colors, :sync] end
@overload open!
# File lib/yell/adapters/io.rb, line 68 def open! @stream.sync = self.sync if @stream.respond_to?(:sync) @stream.flush if @stream.respond_to?(:flush) super end
@overload setup!( options )
# File lib/yell/adapters/io.rb, line 43 def setup!( options ) @stream = nil self.colors = Yell.__fetch__(options, :colors, :default => false) self.formatter = Yell.__fetch__(options, :format, :formatter) self.sync = Yell.__fetch__(options, :sync, :default => true) super end
The IO stream
Adapter classes should provide their own implementation of this method.
# File lib/yell/adapters/io.rb, line 87 def stream synchronize { open! if @stream.nil?; @stream } end
@overload write!( event )
# File lib/yell/adapters/io.rb, line 54 def write!( event ) message = formatter.call(event) # colorize if applicable if colors and color = TTYColors[event.level] message = color + message + TTYColors[-1] end stream.syswrite(message) super end