modify write log
This commit is contained in:
parent
7ec471f990
commit
e28efbe402
1 changed files with 3 additions and 4 deletions
|
|
@ -3,16 +3,15 @@ import 'dart:async';
|
|||
import 'log.dart';
|
||||
|
||||
abstract class Application {
|
||||
late Function(Object, StackTrace) writeLog;
|
||||
|
||||
Application(Function() func, Function(Object, StackTrace) errorListener) {
|
||||
runZonedGuarded(() async {
|
||||
writeLog = (error, stack) => logError('$error:\n$stack');
|
||||
func();
|
||||
}, (error, stack) {
|
||||
writeLog(error, stack);
|
||||
errorListener(error, stack);
|
||||
});
|
||||
}
|
||||
|
||||
void writeLog(Object error, StackTrace stack) {
|
||||
logError('$error:\n$stack');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue