logged<R> method
Implementation
R? logged<R>(R block(), {String? debugLabel, bool propagate = false}) {
try {
final R r = block();
if (r is Future) {
r.catchError((e, StackTrace stack) {
log.severe("[${debugLabel ?? 'operation'}] async: $e", e, stack);
});
}
return r;
} catch (e, stack) {
log.severe("[${debugLabel ?? 'operation'}] $e", e, stack);
if (propagate == true) {
rethrow;
} else {
return null;
}
}
}