Class: Nines::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/nines/logger.rb

Instance Method Summary collapse

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

#closeObject



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

#syncObject



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