app/internal/log: use the app ID as the Android log tag

This way, a Gio app's logs can be filtered uniquely, which wasn't
possible before since the tag "gio" would be the same between gio apps.

Since the app ID is supplied at build time, inject it via a variable
with the linker's help. The variable is only used on Android for now,
but that's OK. It might be useful for other platforms or other internal
packages in the future.

Fixes #84.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
This commit is contained in:
Daniel Martí
2020-05-05 23:37:16 +01:00
committed by Elias Naur
parent ec34eb4919
commit e97adeedd9
4 changed files with 8 additions and 4 deletions
+3 -3
View File
@@ -76,9 +76,9 @@ func (d *AndroidTestDriver) Start(path string) {
ctx, cancel := context.WithCancel(context.Background())
cmd := exec.CommandContext(ctx, d.adbPath,
"logcat",
"-s", // suppress other logs
"-T1", // don't show prevoius log messages
"gio:*", // show all logs from gio
"-s", // suppress other logs
"-T1", // don't show prevoius log messages
appid+":*", // show all logs from our gio app ID
)
logcat, err := cmd.StdoutPipe()
if err != nil {