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