lib/zold/log.rb in zold-0.16.20 vs lib/zold/log.rb in zold-0.16.21

- old
+ new

@@ -19,10 +19,11 @@ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. require 'rainbow' +require 'monitor' STDOUT.sync = true # Zold module. # Author:: Yegor Bugayenko (yegor256@gmail.com) @@ -48,36 +49,36 @@ module Log # Synchronized class Sync def initialize(log) @log = log - @mutex = Mutex.new + @monitor = Monitor.new end def debug(msg) return unless debug? - @mutex.synchronize do + @monitor.synchronize do @log.debug(msg) end end def debug? @log.debug? end def info(msg) return unless info? - @mutex.synchronize do + @monitor.synchronize do @log.info(msg) end end def info? @log.info? end def error(msg) - @mutex.synchronize do + @monitor.synchronize do @log.error(msg) end end end