From 2512ecda9181a7b9ec0c2fe04cc8c35fde0cf751 Mon Sep 17 00:00:00 2001 From: Chaphasilor Date: Mon, 18 Nov 2024 20:45:02 +0100 Subject: [PATCH] improve startup logging --- .../music_player_background_task.dart | 3 ++- lib/setup_logging.dart | 25 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/services/music_player_background_task.dart b/lib/services/music_player_background_task.dart index 73941aa5..1a7547b3 100644 --- a/lib/services/music_player_background_task.dart +++ b/lib/services/music_player_background_task.dart @@ -68,7 +68,8 @@ class MusicPlayerBackgroundTask extends BaseAudioHandler { _audioServiceBackgroundTaskLogger .info("Initializing media-kit for Windows/Linux"); JustAudioMediaKit.title = "Finamp"; - JustAudioMediaKit.prefetchPlaylist = true; // cache upcoming tracks + JustAudioMediaKit.prefetchPlaylist = + true; // cache upcoming tracks, enable gapless playback JustAudioMediaKit.ensureInitialized( linux: true, windows: true, diff --git a/lib/setup_logging.dart b/lib/setup_logging.dart index 386d453a..185c0666 100644 --- a/lib/setup_logging.dart +++ b/lib/setup_logging.dart @@ -35,30 +35,31 @@ Future setupLogging() async { final deviceInfo = DeviceInfoPlugin(); startupLogger.info( - "This is ${packageInfo.appName} version ${packageInfo.version}+${packageInfo.buildNumber} (Signature ${packageInfo.buildSignature}), installed via ${packageInfo.installerStore}."); + "This is ${packageInfo.appName} version ${packageInfo.version}+${packageInfo.buildNumber} (Signature '${packageInfo.buildSignature}'), installed via ${packageInfo.installerStore}."); - startupLogger.info("Device info:"); + String deviceInfoString; if (Platform.isAndroid) { final androidInfo = await deviceInfo.androidInfo; - startupLogger.info( - "Android ${androidInfo.version.release} on ${androidInfo.model} (${androidInfo.product})"); + deviceInfoString = + "Android ${androidInfo.version.release} on ${androidInfo.model} (${androidInfo.product})"; } else if (Platform.isIOS) { final iosInfo = await deviceInfo.iosInfo; - startupLogger.info("iOS ${iosInfo.systemVersion} on ${iosInfo.model}"); + deviceInfoString = "${iosInfo.systemVersion} on ${iosInfo.model}"; } else if (Platform.isMacOS) { final macosInfo = await deviceInfo.macOsInfo; - startupLogger.info( - "macOS ${macosInfo.majorVersion}.${macosInfo.minorVersion}.${macosInfo.patchVersion} on ${macosInfo.model}"); + deviceInfoString = + "macOS ${macosInfo.majorVersion}.${macosInfo.minorVersion}.${macosInfo.patchVersion} on ${macosInfo.model}"; } else if (Platform.isLinux) { final linuxInfo = await deviceInfo.linuxInfo; - startupLogger.info("Linux ${linuxInfo.version} on ${linuxInfo.id}"); + deviceInfoString = "${linuxInfo.version} on ${linuxInfo.id}"; } else if (Platform.isWindows) { final windowsInfo = await deviceInfo.windowsInfo; - startupLogger.info( - "Windows ${windowsInfo.displayVersion} on ${windowsInfo.deviceId}"); + deviceInfoString = + "Windows ${windowsInfo.displayVersion} on ${windowsInfo.deviceId}"; } else { final webInfo = await deviceInfo.webBrowserInfo; - startupLogger - .info("Web browser ${webInfo.userAgent} on ${webInfo.platform}"); + deviceInfoString = + "Web browser ${webInfo.userAgent} on ${webInfo.platform}"; } + startupLogger.info("Running on $deviceInfoString."); }