json static method
Log a JSON object with pretty formatting
Implementation
static void json(
Object? object, {
String tag = 'Reactiv',
LogLevel level = LogLevel.debug,
}) {
if (!config.enabled || level.index < config.minLevel.index) return;
try {
final prettyString = config.prettyJson
? const JsonEncoder.withIndent(' ').convert(object)
: jsonEncode(object);
_log(level, prettyString, tag: tag);
} catch (e) {
_log(
LogLevel.error,
'Failed to encode JSON: $e\nObject: $object',
tag: tag,
);
}
}