instance method ignore

Ruby on Rails edge

Since edge

Signature

ignore(*patterns)

Registers patterns of messages to ignore. Ignored messages aren’t forwarded to the underlying logger, whatever their severity. Returns self, so it can be chained on the constructor.

Regexps are matched against the message, strings are matched literally:

logger.ignore(/Noisy/, 'Also noisy')
logger.error('Noisy message') # not forwarded
logger.error('Also noisy')    # not forwarded

Patterns are matched against message.to_s, so lazily generated messages are evaluated even when they end up ignored.

Parameters

patterns rest
Source
# File activesupport/lib/active_support/proxy_logger.rb, line 51
    def ignore(*patterns)
      return self if patterns.empty?

      @ignored_patterns.concat(patterns)
      @ignored = Regexp.union(@ignored_patterns)
      self
    end

Defined in activesupport/lib/active_support/proxy_logger.rb line 51 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::ProxyLogger

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close