logFilter function Debug

dynamic logFilter([
  1. String? filter
])

Configures log output filtering.

filter:

  • If null or empty (''), all filtering is disabled, and all messages are shown.
  • If non-empty and not starting with !, only log messages containing this exact string will be shown.
  • If non-empty and starting with !, only log messages not containing the rest of the string (after !) will be shown (inverse filtering).

Implementation

logFilter([String? filter]) {
  if (filter == null || filter.isEmpty) {
    _filterText = '';
    _filterInverse = false;
  } else {
    if (filter.startsWith('!')) {
      _filterInverse = true;
      _filterText = filter.substring(1);
    } else {
      _filterInverse = false;
      _filterText = filter;
    }
    if (_filterText.isEmpty) {
      _filterInverse = false;
    }
  }
}