def logger(options)
if options[:level]
options[:level] = options[:level].to_sym
unless [:debug, :info, :warn, :error].include? options[:level]
::Guard::UI.warning "Invalid log level `#{ options[:level] }` ignored. Please use either :debug, :info, :warn or :error."
options.delete :level
end
end
if options[:only] && options[:except]
::Guard::UI.warning 'You cannot specify the logger options :only and :except at the same time.'
options.delete :only
options.delete :except
end
[:only, :except].each do |name|
if options[name]
list = [].push(options[name]).flatten.map { |plugin| Regexp.escape(plugin.to_s) }.join('|')
options[name] = Regexp.new(list, Regexp::IGNORECASE)
end
end
::Guard::UI.options = ::Guard::UI.options.merge options
end