logWithJson method

void logWithJson(
  1. String message, {
  2. dynamic json,
  3. String? debugId,
})

Implementation

void logWithJson(String message, {dynamic json, String? debugId}) {
  debugPrint("\x1B[33m$namespace[${debugId ?? 'ID'}] $message");
  if (json != null) {
    final str = jsonString(json).splitMapJoin(
      '\n',
      onMatch: (m) => "${m[0]}\x1B[33m$namespace[${debugId ?? 'ID'}]    ",
      onNonMatch: (s) => s,
    );
    debugPrint("\x1B[33m$namespace[${debugId ?? 'ID'}]    $str");
  }
}