Class: CouchPopulator::Logger

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

Instance Method Summary collapse

Constructor Details

#initialize(logfile = '') ⇒ Logger

Returns a new instance of Logger.



3
4
5
# File 'lib/logger.rb', line 3

def initialize(logfile='')
  @out = logfile.empty? ? $stdout : File.new(logfile, "a")
end

Instance Method Details

#<<(message) ⇒ Object



12
13
14
# File 'lib/logger.rb', line 12

def <<(message)
  log(message)
end

#log(message) ⇒ Object



7
8
9
10
# File 'lib/logger.rb', line 7

def log(message)
  t = Time.now
  @out << "#{t.strftime("%Y-%m-%d %H:%M:%S")}:#{t.usec} :: #{message} \n"
end