json static method

void json(
  1. dynamic object
)

Logs a formatted JSON object with visual separators.

This method creates a visually distinct log entry for JSON or complex objects, using separators and special formatting to make the output easily readable. The object is logged as a fatal level message with no method count and clear visual boundaries.

object The object to be logged, typically a Map, List, or any JSON-serializable object

Example usage:

Console.json({'user': 'john', 'status': 'active', 'permissions': ['read', 'write']});
// Output:
// ==================================================
// {user: john, status: active, permissions: [read, write]}
// ==================================================

Implementation

static void json(dynamic object) {
  var log = Logger(
    level: isTestRunning() ? Level.off : Level.debug,
    printer: PrettyPrinter(
      printEmojis: false,
      noBoxingByDefault: true,
      excludeBox: {},
      colors: true,
      methodCount: 0,
    ),
  );

  log.f("=" * 50 + '\n');
  log.f(object);
  log.f('\n${"=" * 50}');
}