json static method

void json(
  1. dynamic message, {
  2. String? tag,
  3. DateTime? time,
  4. Object? error,
  5. StackTrace? stackTrace,
})

Log pretty JSON

Implementation

static void json(
  dynamic message, {
  String? tag,
  DateTime? time,
  Object? error,
  StackTrace? stackTrace,
}) {
  final json = _encoder.convert(message);
  final messageString = tag != null ? '$tag:\n$json' : json;

  _logger.log(
    Level.debug,
    messageString,
    time: time,
    error: error,
    stackTrace: stackTrace,
  );
}