modify write log

This commit is contained in:
toki 2023-03-17 07:08:16 +09:00
parent 7ec471f990
commit e28efbe402

View file

@ -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');
}
}