entry method

LogEntry entry()

Implementation

LogEntry entry() {
  final time = DateTime.utc(2026, 1, 1, 12, 0, _random.nextInt(8), 0, _random.nextInt(3));
  final error = _chance(0.3) ? LogError(type: _pick(_words), message: '${_pick(_words)} ${_pick(_words)}') : null;
  return LogEntry(
    time: time,
    level: _pick(LogLevel.values),
    message: '${_pick(_words)} ${_pick(_words)}',
    tags: _subset(_tags),
    location: _chance(0.5) ? 'main (file:///app/main.dart:${_random.nextInt(9)}:1)' : null,
    stackTrace: _chance(0.3) ? StackTrace.fromString('#0      main (file:///app/main.dart:1:1)\n') : null,
    error: error,
    attributes: LogAttributes([
      if (_chance(0.6)) userId('${_random.nextInt(3)}'),
      if (_chance(0.4)) attempt(_random.nextInt(3)),
      if (_chance(0.2)) ratio(_random.nextInt(3) / 2),
      if (_chance(0.2))
        payload(
          LogMap({
            'k': LogInt(_random.nextInt(2)),
            'l': LogList([LogString(_pick(_words))]),
          }),
        ),
    ]),
  );
}