mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Log to a (configurable) file
This commit is contained in:
parent
2f4bdaf67a
commit
57975a489f
2 changed files with 12 additions and 4 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue