query method

LogQuery query()

Implementation

LogQuery query() => LogQuery(
  filter: LogFilter(
    after: _chance(0.3) ? DateTime.utc(2026, 1, 1, 12, 0, _random.nextInt(8)) : null,
    before: _chance(0.3) ? DateTime.utc(2026, 1, 1, 12, 0, _random.nextInt(8)) : null,
    levels: _subset(LogLevel.values, max: 2),
    tags: _subset(_tags, max: 2),
    attributes: [
      if (_chance(0.3)) userId('${_random.nextInt(3)}'),
      if (_chance(0.2)) attempt(_random.nextInt(3)),
      if (_chance(0.1)) ratio(_random.nextInt(3) / 2),
      if (_chance(0.1))
        // Map keys in the other order than the entry's: equal values must still match.
        payload(
          LogMap({
            'l': LogList([LogString(_pick(_words))]),
            'k': LogInt(_random.nextInt(2)),
          }),
        ),
    ],
    text: _chance(0.4) ? _pick(_needles) : '',
  ),
  newestFirst: _chance(0.5),
  limit: _chance(0.8) ? 1 + _random.nextInt(4) : null,
);