chore(debug): co-locate per-UID logs with dumps

Per-UID dossier logs moved from /data/adb/tricky_store/logs to
/data/local/tmp/teesim, beside the .bin dumps, so the whole debug
trail comes off the device in one `adb pull /data/local/tmp/teesim/`
with no root and no /sdcard hop.

The release purge now sweeps .log/.log.1 from the diagnostic dir and
keeps legacy sweeps of both old locations (loose /data/local/tmp and
the module config dir) so upgrading to a release build leaves nothing
behind. Repoint package.sh --clear-logs to the new path.
This commit is contained in:
Enginex0
2026-06-04 21:15:34 +01:00
parent 9561f7d9c0
commit f69fee21a8
3 changed files with 11 additions and 5 deletions
@@ -81,14 +81,18 @@ object App {
*/ */
private fun purgeDebugDiagnostics() { private fun purgeDebugDiagnostics() {
if (SystemLogger.isDebugBuild) return if (SystemLogger.isDebugBuild) return
// .bin dumps and per-UID logs now share the diagnostic dir.
purgeStale(File(InterceptorUtils.DIAGNOSTIC_DIR), InterceptorUtils.DIAGNOSTIC_DIR) { name -> purgeStale(File(InterceptorUtils.DIAGNOSTIC_DIR), InterceptorUtils.DIAGNOSTIC_DIR) { name ->
name.startsWith("teesim-") && name.endsWith(".bin") name.startsWith("teesim-") &&
(name.endsWith(".bin") || name.endsWith(".log") || name.endsWith(".log.1"))
} }
// Older debug installs wrote the dumps loose in /data/local/tmp; sweep those too. // Older debug installs wrote dumps loose in /data/local/tmp and per-UID logs under the
// module config dir; sweep both legacy locations so upgrading to a release build leaves
// nothing behind.
purgeStale(File("/data/local/tmp"), "/data/local/tmp") { name -> purgeStale(File("/data/local/tmp"), "/data/local/tmp") { name ->
name.startsWith("teesim-") && name.endsWith(".bin") name.startsWith("teesim-") && name.endsWith(".bin")
} }
purgeStale(File("${ConfigurationManager.CONFIG_PATH}/logs"), "per-UID log dir") { name -> purgeStale(File("${ConfigurationManager.CONFIG_PATH}/logs"), "legacy per-UID log dir") { name ->
name.startsWith("teesim-uid-") && (name.endsWith(".log") || name.endsWith(".log.1")) name.startsWith("teesim-uid-") && (name.endsWith(".log") || name.endsWith(".log.1"))
} }
} }
@@ -161,7 +161,9 @@ object SystemLogger {
uidLog(uid, txId, event, detail()) uidLog(uid, txId, event, detail())
} }
private val uidLogDir = File(ConfigurationManager.CONFIG_PATH, "logs") // Co-located with the .bin dumps in InterceptorUtils.DIAGNOSTIC_DIR so every debug artifact sits
// in one adb-pullable dir; release builds purge it (see App.purgeDebugDiagnostics).
private val uidLogDir = File("/data/local/tmp/teesim")
private const val UID_LOG_MAX_BYTES = 4L * 1024 * 1024 private const val UID_LOG_MAX_BYTES = 4L * 1024 * 1024
private val uidWriters = ConcurrentHashMap<Int, UidLogFile>() private val uidWriters = ConcurrentHashMap<Int, UidLogFile>()
+1 -1
View File
@@ -158,7 +158,7 @@ deploy_zip() {
if [[ "$CLEAR_LOGS" == true ]]; then if [[ "$CLEAR_LOGS" == true ]]; then
bold "==> Clearing per-UID diagnostic logs" bold "==> Clearing per-UID diagnostic logs"
adb shell "rm -f /data/adb/tricky_store/logs/teesim-uid-*" 2>/dev/null || true adb shell "rm -f /data/local/tmp/teesim/teesim-uid-*" 2>/dev/null || true
fi fi
bold "==> Deploying $name" bold "==> Deploying $name"