Log to a (configurable) file

This commit is contained in:
Scott Schneider 2013-11-08 10:48:51 -08:00
parent 2f4bdaf67a
commit 57975a489f
2 changed files with 12 additions and 4 deletions

View file

@ -1,13 +1,20 @@
require 'rubygems' unless defined?(Gem)
class Logger
def initialize
def initialize(
f = '/var/log/vmware-host-pooler.log'
)
@file = f
end
def log level, string
time = Time.new
stamp = time.strftime('%Y-%m-%d %H:%M:%S')
puts "[#{stamp}] #{string}"
open(@file, 'a') do |f|
f.puts "[#{stamp}] #{string}"
end
end
end