Class: Nines::Logger
- Inherits:
-
Object
- Object
- Nines::Logger
- Defined in:
- lib/nines/logger.rb
Instance Method Summary collapse
- #close ⇒ Object
- #debug(*args) ⇒ Object
-
#initialize(io) ⇒ Logger
constructor
A new instance of Logger.
- #puts(*args) ⇒ Object (also: #error)
- #sync ⇒ Object
- #sync=(val) ⇒ Object
Constructor Details
#initialize(io) ⇒ Logger
Returns a new instance of Logger.
4 5 6 7 |
# File 'lib/nines/logger.rb', line 4 def initialize(io) @mutex = Mutex.new @io = io end |
Instance Method Details
#close ⇒ Object
21 22 23 |
# File 'lib/nines/logger.rb', line 21 def close @io.close unless @io == STDOUT || @io == STDERR end |
#debug(*args) ⇒ Object
17 18 19 |
# File 'lib/nines/logger.rb', line 17 def debug(*args) @mutex.synchronize { @io.puts args } if Nines::App.verbose end |
#puts(*args) ⇒ Object Also known as: error
12 13 14 |
# File 'lib/nines/logger.rb', line 12 def puts(*args) @mutex.synchronize { @io.puts args } end |
#sync ⇒ Object
9 |
# File 'lib/nines/logger.rb', line 9 def sync ; @io.sync ; end |
#sync=(val) ⇒ Object
10 |
# File 'lib/nines/logger.rb', line 10 def sync=(val) ; @io.sync = val ; end |