Update logging
This commit is contained in:
@@ -27,6 +27,10 @@ class CoreFacadeImpl with ExceptionHandler, InfraLogger implements CoreFacade {
|
|||||||
return exceptionHandler(
|
return exceptionHandler(
|
||||||
() {
|
() {
|
||||||
loggy.debug("setting up singbox");
|
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
|
return singbox
|
||||||
.setup(
|
.setup(
|
||||||
filesEditor.baseDir.path,
|
filesEditor.baseDir.path,
|
||||||
|
|||||||
@@ -84,7 +84,10 @@ class ProfilesRepositoryImpl
|
|||||||
)
|
)
|
||||||
.run();
|
.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();
|
.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) {
|
TaskEither<ProfileFailure, Unit> update(Profile baseProfile) {
|
||||||
return exceptionHandler(
|
return exceptionHandler(
|
||||||
() async {
|
() async {
|
||||||
|
loggy.debug(
|
||||||
|
"updating profile [${baseProfile.name} (${baseProfile.id})]",
|
||||||
|
);
|
||||||
return fetch(baseProfile.url, baseProfile.id)
|
return fetch(baseProfile.url, baseProfile.id)
|
||||||
.flatMap(
|
.flatMap(
|
||||||
(remoteProfile) => TaskEither(() async {
|
(remoteProfile) => TaskEither(() async {
|
||||||
@@ -130,7 +139,10 @@ class ProfilesRepositoryImpl
|
|||||||
)
|
)
|
||||||
.run();
|
.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(
|
return parseResult.fold(
|
||||||
(l) async {
|
(l) async {
|
||||||
await File(path).delete();
|
await File(path).delete();
|
||||||
|
loggy.warning("error parsing config: $l");
|
||||||
return left(ProfileFailure.invalidConfig(l.msg));
|
return left(ProfileFailure.invalidConfig(l.msg));
|
||||||
},
|
},
|
||||||
(_) {
|
(_) {
|
||||||
|
|||||||
@@ -23,7 +23,9 @@ sealed class ProfileFailure with _$ProfileFailure, Failure {
|
|||||||
return switch (this) {
|
return switch (this) {
|
||||||
ProfileUnexpectedFailure() => t.failure.profiles.unexpected,
|
ProfileUnexpectedFailure() => t.failure.profiles.unexpected,
|
||||||
ProfileNotFoundFailure() => t.failure.profiles.notFound,
|
ProfileNotFoundFailure() => t.failure.profiles.notFound,
|
||||||
ProfileInvalidConfigFailure() => t.failure.profiles.invalidConfig,
|
ProfileInvalidConfigFailure(:final message) =>
|
||||||
|
t.failure.profiles.invalidConfig +
|
||||||
|
(message == null ? "" : ": $message"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'package:loggy/loggy.dart';
|
|||||||
/// used in notifiers and controllers
|
/// used in notifiers and controllers
|
||||||
mixin AppLogger implements LoggyType {
|
mixin AppLogger implements LoggyType {
|
||||||
@override
|
@override
|
||||||
Loggy<AppLogger> get loggy => Loggy<AppLogger>('🧮 $runtimeType');
|
Loggy<AppLogger> get loggy => Loggy<AppLogger>('$runtimeType');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// presentation layer logger
|
/// presentation layer logger
|
||||||
@@ -13,7 +13,7 @@ mixin AppLogger implements LoggyType {
|
|||||||
/// used in widgets and ui
|
/// used in widgets and ui
|
||||||
mixin PresLogger implements LoggyType {
|
mixin PresLogger implements LoggyType {
|
||||||
@override
|
@override
|
||||||
Loggy<PresLogger> get loggy => Loggy<PresLogger>('🏰 $runtimeType');
|
Loggy<PresLogger> get loggy => Loggy<PresLogger>('$runtimeType');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// data layer logger
|
/// data layer logger
|
||||||
@@ -21,7 +21,7 @@ mixin PresLogger implements LoggyType {
|
|||||||
/// used in Repositories, DAOs, Services
|
/// used in Repositories, DAOs, Services
|
||||||
mixin InfraLogger implements LoggyType {
|
mixin InfraLogger implements LoggyType {
|
||||||
@override
|
@override
|
||||||
Loggy<InfraLogger> get loggy => Loggy<InfraLogger>('💾 $runtimeType');
|
Loggy<InfraLogger> get loggy => Loggy<InfraLogger>('$runtimeType');
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class LoggerMixin {
|
abstract class LoggerMixin {
|
||||||
|
|||||||
Reference in New Issue
Block a user