makeObjectGroup method
groupName is for example GROUP_OBJECT
Implementation
@override
void makeObjectGroup(final String groupName, final LogRecord logRecord) {
void makeGroupWithString(
final String groupName, final String objectAsString) {
print(groupName);
print(objectAsString);
}
if (logRecord.error != null) {
final Object? error = logRecord.error;
final String groupNameWithType = "$groupName (${error.runtimeType})";
if (error is Map || error is List) {
try {
makeGroupWithString(groupNameWithType, prettyPrintJson(error));
} on FormatException {
makeGroupWithString(groupNameWithType, error.toString());
}
} else {
try {
final decoded = JSON.decode(error.toString());
makeGroupWithString(groupNameWithType, prettyPrintJson(decoded));
} on Exception {
makeGroupWithString(groupNameWithType, error.toString());
}
}
}
}