ResourceLogger doesn't need to be thread-safe. Vagrant is not multi-threaded.

This commit is contained in:
Mitchell Hashimoto 2011-07-10 14:44:48 -07:00
parent aaa09749e4
commit 050677b359
1 changed files with 1 additions and 8 deletions

View File

@ -1,5 +1,3 @@
require 'thread'
module Vagrant
module Util
# Represents a logger for a specific resource within Vagrant. Each
@ -9,11 +7,8 @@ module Vagrant
#
# [resource] message
#
# This class is thread safe. The backing class which actually does
# all the logging IO is protected.
class ResourceLogger
@@singleton_logger = nil
@@writer_lock = Mutex.new
# The resource which this logger represents.
attr_reader :resource
@ -53,9 +48,7 @@ module Vagrant
[:debug, :info, :error, :fatal].each do |method|
define_method(method) do |message|
@@writer_lock.synchronize do
logger.send(method, "[#{resource}] #{message}")
end
logger.send(method, "[#{resource}] #{message}")
end
end
end