[PR #1837] Add logging option settings #1718

Open
opened 2026-04-25 00:00:48 +02:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/advplyr/audiobookshelf-app/pull/1837
Author: @ckbaker10
Created: 3/30/2026
Status: 🔄 Open

Base: masterHead: add-logging-option-settings


📝 Commits (2)

  • 5ff872b Added functionality to disable logging
  • 97bc3a1 Build error fix

📊 Changes

5 files changed (+24 additions, -3 deletions)

View changed files

📝 android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt (+4 -2)
📝 android/app/src/main/java/com/audiobookshelf/app/plugins/AbsLogger.kt (+6 -0)
📝 ios/App/App/capacitor.config.json (+1 -1)
📝 pages/settings.vue (+12 -0)
📝 strings/en-us.json (+1 -0)

📄 Description

Brief summary

Adds a toggle in the Android settings to enable/disable logging. Logging is disabled by default to reduce unnecessary database writes and improve performance. When enabled, logs are persisted to the DB and emitted to listeners as before.

Pull Request Type

  • Affects: Android only
  • Changes: Backend (native Kotlin) and Frontend (settings UI)

In-depth Description

Previously, AbsLogger always saved every log entry to the database via DeviceManager.dbManager.saveLog() and emitted it to listeners. This happens on every sync cycle (every 15 seconds during playback), on every connection event, and throughout the app lifecycle -- generating a large volume of log data even when no one is looking at it.

This PR adds an enableLogging boolean to DeviceSettings, defaulting to false. When disabled, all AbsLogger.info(), AbsLogger.error(), and AbsLogger.log() calls return early without persisting or emitting anything. Users can enable logging in Settings when they need to capture logs for debugging or bug reports.

Changes

  • DeviceClasses.kt -- Added enableLogging: Boolean field to DeviceSettings data class, defaulting to false
  • AbsLogger.kt -- Added isEnabled property that reads from DeviceManager.deviceData.deviceSettings?.enableLogging. All companion object logging methods (log, info, error) now return early if logging is disabled.
  • settings.vue -- Added an Android-only toggle switch (v-if="!isiOS") with data binding, toggle method, and device settings sync
  • en-us.json -- Added "LabelEnableLogging": "Enable logging" string

How have you tested this?

  1. Open the app with a fresh install -- verify logging is disabled by default
  2. Go to Settings -- verify the "Enable logging" toggle is visible and off
  3. Play an audiobook -- verify no logs are written (check via the logs screen)
  4. Enable the toggle -- verify logs start appearing
  5. Disable the toggle again -- verify logging stops
  6. Restart the app -- verify the setting persists

Screenshots

N/A -- minor UI addition (single toggle switch in existing settings page).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/advplyr/audiobookshelf-app/pull/1837 **Author:** [@ckbaker10](https://github.com/ckbaker10) **Created:** 3/30/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `add-logging-option-settings` --- ### 📝 Commits (2) - [`5ff872b`](https://github.com/advplyr/audiobookshelf-app/commit/5ff872bff050df0012ebe7d6801a15cdb6cc33a9) Added functionality to disable logging - [`97bc3a1`](https://github.com/advplyr/audiobookshelf-app/commit/97bc3a13fe218567303f224c61281979e0975e64) Build error fix ### 📊 Changes **5 files changed** (+24 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `android/app/src/main/java/com/audiobookshelf/app/data/DeviceClasses.kt` (+4 -2) 📝 `android/app/src/main/java/com/audiobookshelf/app/plugins/AbsLogger.kt` (+6 -0) 📝 `ios/App/App/capacitor.config.json` (+1 -1) 📝 `pages/settings.vue` (+12 -0) 📝 `strings/en-us.json` (+1 -0) </details> ### 📄 Description ## Brief summary Adds a toggle in the Android settings to enable/disable logging. Logging is disabled by default to reduce unnecessary database writes and improve performance. When enabled, logs are persisted to the DB and emitted to listeners as before. ## Pull Request Type - Affects: Android only - Changes: Backend (native Kotlin) and Frontend (settings UI) ## In-depth Description Previously, `AbsLogger` always saved every log entry to the database via `DeviceManager.dbManager.saveLog()` and emitted it to listeners. This happens on every sync cycle (every 15 seconds during playback), on every connection event, and throughout the app lifecycle -- generating a large volume of log data even when no one is looking at it. This PR adds an `enableLogging` boolean to `DeviceSettings`, defaulting to `false`. When disabled, all `AbsLogger.info()`, `AbsLogger.error()`, and `AbsLogger.log()` calls return early without persisting or emitting anything. Users can enable logging in Settings when they need to capture logs for debugging or bug reports. ### Changes - **`DeviceClasses.kt`** -- Added `enableLogging: Boolean` field to `DeviceSettings` data class, defaulting to `false` - **`AbsLogger.kt`** -- Added `isEnabled` property that reads from `DeviceManager.deviceData.deviceSettings?.enableLogging`. All companion object logging methods (`log`, `info`, `error`) now return early if logging is disabled. - **`settings.vue`** -- Added an Android-only toggle switch (`v-if="!isiOS"`) with data binding, toggle method, and device settings sync - **`en-us.json`** -- Added `"LabelEnableLogging": "Enable logging"` string ## How have you tested this? 1. Open the app with a fresh install -- verify logging is disabled by default 2. Go to Settings -- verify the "Enable logging" toggle is visible and off 3. Play an audiobook -- verify no logs are written (check via the logs screen) 4. Enable the toggle -- verify logs start appearing 5. Disable the toggle again -- verify logging stops 6. Restart the app -- verify the setting persists ## Screenshots N/A -- minor UI addition (single toggle switch in existing settings page). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2026-04-25 00:00:48 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf-app#1718