Update logging

This commit is contained in:
problematicconsumer
2023-08-22 01:02:33 +03:30
parent f6d606a068
commit 03ae15010a
4 changed files with 26 additions and 7 deletions

View File

@@ -27,6 +27,10 @@ class CoreFacadeImpl with ExceptionHandler, InfraLogger implements CoreFacade {
return exceptionHandler(
() {
loggy.debug("setting up singbox");
loggy.debug("base dir: ${filesEditor.baseDir.path}");
loggy.debug("working dir: ${filesEditor.workingDir.path}");
loggy.debug("temp dir: ${filesEditor.tempDir.path}");
return singbox
.setup(
filesEditor.baseDir.path,

View File

@@ -84,7 +84,10 @@ class ProfilesRepositoryImpl
)
.run();
},
ProfileUnexpectedFailure.new,
(error, stackTrace) {
loggy.warning("error adding profile by url", error, stackTrace);
return ProfileUnexpectedFailure(error, stackTrace);
},
);
}
@@ -107,7 +110,10 @@ class ProfilesRepositoryImpl
)
.run();
},
ProfileUnexpectedFailure.new,
(error, stackTrace) {
loggy.warning("error adding profile", error, stackTrace);
return ProfileUnexpectedFailure(error, stackTrace);
},
);
}
@@ -115,6 +121,9 @@ class ProfilesRepositoryImpl
TaskEither<ProfileFailure, Unit> update(Profile baseProfile) {
return exceptionHandler(
() async {
loggy.debug(
"updating profile [${baseProfile.name} (${baseProfile.id})]",
);
return fetch(baseProfile.url, baseProfile.id)
.flatMap(
(remoteProfile) => TaskEither(() async {
@@ -130,7 +139,10 @@ class ProfilesRepositoryImpl
)
.run();
},
ProfileUnexpectedFailure.new,
(error, stackTrace) {
loggy.warning("error updating profile", error, stackTrace);
return ProfileUnexpectedFailure(error, stackTrace);
},
);
}
@@ -170,6 +182,7 @@ class ProfilesRepositoryImpl
return parseResult.fold(
(l) async {
await File(path).delete();
loggy.warning("error parsing config: $l");
return left(ProfileFailure.invalidConfig(l.msg));
},
(_) {