Skip to content

Commit

Permalink
improve startup logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed Nov 18, 2024
1 parent fbb4f78 commit 2512ecd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
3 changes: 2 additions & 1 deletion lib/services/music_player_background_task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
25 changes: 13 additions & 12 deletions lib/setup_logging.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,30 +35,31 @@ Future<void> 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.");
}

0 comments on commit 2512ecd

Please sign in to comment.