memen45 / SubMusic

Sync music and podcasts to your Garmin watch from your own SubSonic or Ampache server
GNU General Public License v3.0
122 stars 13 forks source link

Add debug mode (remove default debug logging) #69

Closed memen45 closed 1 year ago

memen45 commented 1 year ago

For debugging, many System.println() statements are scattered throughout the code base. As it seems, these statements are executed in production as well and may slow down the app or cause Out of Memory errors.

Proposed solution

Add a global boolean variable debug and wrap all println statements:

if (debug) {
    System.println("Log message");
}

The debug variable should be loaded on app start with the debug setting. A menu item should be created in the settings menu to enable / disabe debugging. Note that even after enabling the debug setting, the user has to create the log file manually on the device to obtain any logs.