def logger(options)
      if options[:level]
        options[:level] = options[:level].to_sym

        unless [:debug, :info, :warn, :error].include? options[:level]
          UI.warning(format(WARN_INVALID_LOG_LEVEL, options[:level]))
          options.delete :level
        end
      end

      if options[:only] && options[:except]
        UI.warning WARN_INVALID_LOG_OPTIONS

        options.delete :only
        options.delete :except
      end

      # Convert the :only and :except options to a regular expression
      [:only, :except].each do |name|
        next unless options[name]

        list = [].push(options[name]).flatten.map do |plugin|
          Regexp.escape(plugin.to_s)
        end

        options[name] = Regexp.new(list.join("|"), Regexp::IGNORECASE)
      end

      UI.options = UI.options.merge(options)
    end
def logger(options)
      if options[:level]
        options[:level] = options[:level].to_sym

        unless [:debug, :info, :warn, :error].include? options[:level]
          UI.warning(format(WARN_INVALID_LOG_LEVEL, options[:level]))
          options.delete :level
        end
      end

      if options[:only] && options[:except]
        UI.warning WARN_INVALID_LOG_OPTIONS

        options.delete :only
        options.delete :except
      end

      # Convert the :only and :except options to a regular expression
      [:only, :except].each do |name|
        next unless options[name]

        list = [].push(options[name]).flatten.map do |plugin|
          Regexp.escape(plugin.to_s)
        end

        options[name] = Regexp.new(list.join("|"), Regexp::IGNORECASE)
      end

      UI.options = UI.options.merge(options)
    end
Configures the Guard logger.

 * Log level must be either `:debug`, `:info`, `:warn` or `:error`.
 * Template supports the following placeholders: `:time`, `:severity`,
   `:progname`, `:pid`, `:unit_of_work_id` and `:message`.
 * Time format directives are the same as `Time#strftime` or
   `:milliseconds`.
 * The `:only` and `:except` options must be a `RegExp`.

 @example Set the log level
   logger level: :warn

 @example Set a custom log template
   logger template: '[Guard - :severity - :progname - :time] :message'

 @example Set a custom time format
   logger time_format: '%h'

 @example Limit logging to a Guard plugin
   logger only: :jasmine

 @example Log all but not the messages from a specific Guard plugin
   logger except: :jasmine

 @param [Hash] options the log options
 @option options [String, Symbol] level the log level
 @option options [String] template the logger template
 @option options [String, Symbol] time_format the time format
 @option options [Regexp] only show only messages from the matching Guard
   plugin
 @option options [Regexp] except does not show messages from the matching
   Guard plugin