lib/zold/log.rb in zold-0.4 vs lib/zold/log.rb in zold-0.4.1

- old
+ new

@@ -27,49 +27,56 @@ # Copyright:: Copyright (c) 2018 Yegor Bugayenko # License:: MIT module Zold # Logging class Log + MUTEX = Mutex.new + def self.print(text) + MUTEX.synchronize do + puts(text) + end + end + def debug(msg) # nothing end def debug? false end def info(msg) - puts msg + Log.print(msg) end def info? true end def error(msg) - puts "#{Rainbow('ERROR').red}: #{msg}" + Log.print("#{Rainbow('ERROR').red}: #{msg}") end # Extra verbose log class Verbose def debug(msg) - puts msg + Log.print(msg) end def debug? true end def info(msg) - puts msg + Log.print(msg) end def info? true end def error(msg) - puts "#{Rainbow('ERROR').red}: #{msg}" + Log.print("#{Rainbow('ERROR').red}: #{msg}") end end # Log that doesn't log anything class Quiet