Class: Ocak::WatchFormatter
- Inherits:
-
Object
- Object
- Ocak::WatchFormatter
- Defined in:
- lib/ocak/logger.rb
Overview
Colorized real-time terminal output for –watch mode.
Instance Method Summary collapse
- #emit(agent_name, event) ⇒ Object
-
#initialize(io = $stderr) ⇒ WatchFormatter
constructor
A new instance of WatchFormatter.
Constructor Details
#initialize(io = $stderr) ⇒ WatchFormatter
Returns a new instance of WatchFormatter.
120 121 122 123 124 |
# File 'lib/ocak/logger.rb', line 120 def initialize(io = $stderr) @io = io @tty = io.respond_to?(:tty?) && io.tty? @mutex = Mutex.new end |
Instance Method Details
#emit(agent_name, event) ⇒ Object
126 127 128 129 130 131 132 133 |
# File 'lib/ocak/logger.rb', line 126 def emit(agent_name, event) return unless event line = format_event(agent_name, event) return unless line @mutex.synchronize { @io.puts line } end |