Remove redundant logs

This commit is contained in:
problematicconsumer
2024-03-06 21:37:51 +03:30
parent 2c63ab6241
commit ed49f8c114

View File

@@ -93,7 +93,6 @@ Future<void> lazyBootstrap(
final debug = container.read(debugModeNotifierProvider) || kDebugMode;
if (PlatformUtils.isDesktop) {
Logger.bootstrap.info("Starting Window Contoller");
await _init(
"window controller",
() => container.read(windowNotifierProvider.future),
@@ -107,61 +106,50 @@ Future<void> lazyBootstrap(
} else {
Logger.bootstrap.debug("silent start, remain hidden accessible via tray");
}
Logger.bootstrap.info("Starting Auto Start Service");
await _init(
"auto start service",
() => container.read(autoStartNotifierProvider.future),
);
}
Logger.bootstrap.info("Starting Log Repository");
await _init(
"logs repository",
() => container.read(logRepositoryProvider.future),
);
Logger.bootstrap.info("Starting Logger Contoller");
await _init("logger controller", () => LoggerController.postInit(debug));
Logger.bootstrap.info(appInfo.format());
Logger.bootstrap.info("Starting GeoAssets");
await _init(
"geo assets repository",
() => container.read(geoAssetRepositoryProvider.future),
);
Logger.bootstrap.info("Starting Profile Repository");
await _init(
"profile repository",
() => container.read(profileRepositoryProvider.future),
);
Logger.bootstrap.info("Starting Active Profile");
await _safeInit(
"active profile",
() => container.read(activeProfileProvider.future),
timeout: 1000,
);
Logger.bootstrap.info("Starting Deep Link Service");
await _safeInit(
"deep link service",
() => container.read(deepLinkNotifierProvider.future),
timeout: 1000,
);
Logger.bootstrap.info("Starting Singbox Service Provider");
await _init(
"sing-box",
() => container.read(singboxServiceProvider).init(),
);
if (PlatformUtils.isDesktop) {
Logger.bootstrap.info("Starting System Tray");
await _safeInit(
"system tray",
() => container.read(systemTrayNotifierProvider.future),
timeout: 1000,
);
Logger.bootstrap.info("System Tray initialized");
}
if (Platform.isAndroid) {
Logger.bootstrap.info("Starting FlutterDisplayMode.setHighRefreshRate");
await _safeInit(
"android display mode",
() async {
@@ -191,13 +179,14 @@ Future<T> _init<T>(
int? timeout,
}) async {
final stopWatch = Stopwatch()..start();
Logger.bootstrap.info("initializing [$name]");
Future<T> func() => timeout != null
? initializer().timeout(Duration(milliseconds: timeout))
: initializer();
try {
final result = await func();
Logger.bootstrap.debug(
"[$name] initialized in ${stopWatch.elapsedMilliseconds}ms $result");
Logger.bootstrap
.debug("[$name] initialized in ${stopWatch.elapsedMilliseconds}ms");
return result;
} catch (e, stackTrace) {
Logger.bootstrap.error("[$name] error initializing", e, stackTrace);