Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add in-app log viewer #3597

Closed
mnalis opened this issue Dec 17, 2021 · 5 comments · Fixed by #5335
Closed

Add in-app log viewer #3597

mnalis opened this issue Dec 17, 2021 · 5 comments · Fixed by #5335
Labels
help wanted help by contributors is appreciated; might be a good first contribution for first-timers

Comments

@mnalis
Copy link
Member

mnalis commented Dec 17, 2021

Use case
To help debug issues, in-app log viewer would be useful.

Proposed Solution
It has been mentioned several times by @westnordost, and that @matkoniecz might want to do it and that the ticket for it would be created, but is seems to have slipped, so I'm opening this one.

See for example #3290 (comment), #1892 (comment), #3406 (comment)

@westnordost
Copy link
Member

I guess this is forthcoming of you, but I don't need a public issue in this tracker for everything I plan to do for this app.

@mnalis

This comment has been minimized.

@westnordost
Copy link
Member

Is this something I can assign to you, @matkoniecz ? I think I rememeber you mentioning you wanted to work on this?

@matkoniecz matkoniecz self-assigned this Jan 16, 2022
@westnordost
Copy link
Member

westnordost commented Apr 24, 2022

Here is a rough outline how it should look.

Interface-wise

I think easiest would be to let our Log object have the same interface as the Android one, so no code changes other than changing the import are necessary. Roughly it shall look like this:

interface Logger {
  fun i(tag: String, message: String)
  // ... etc
}

object Log {
  var instance: Logger? = null

  override fun i(tag: String, message: String) = instance?.i(tag, message)
  // ...etc
}

class AndroidLogger : Logger {
  // implement...
}

And on application start, Log.instance = AndroidLogger(...) is set.
In tests, it is simply not set or some TestLogger (or mock) that does some testing is used.

Implementation-wise

The AndroidLogger should append the logs into a database table. Logs that exceed a certain size (or age) must be deleted. Maybe using the same mechanism as old quest data is deleted.
Additionally, it could append the log to the system log (as now) but not sure if this is necessary or useful.

UI

In the about screen next to the links to reporting a bug etc, there should be a link to a list-view of the log. For the best utility, it should have the following features:

  • filter by string
  • supply start and end date+time
  • dropdown for selecting which severity to display (verbose, debug, info, error), like in Android Studio
  • a way to export the filtered log output*

* since the app should not require file storage permission, exporting to a file in e.g. Downloads directory is out of question. Maybe "copy to clipboard" would work. Or "attach to mail (to [email protected])" would work. Maybe there is a better idea.

Furthermore, whenever a crash report is sent, the part of the log directly preceding the crash should also be attached to the error-report mail.

So, the log messages from the database are 1. displayed in a RecyclerView list and 2. can be converted into a newline-concatenated string

@westnordost
Copy link
Member

@matkoniecz did not start working on it yet, so for the time being, this is free for the taking / can be done by other people interested in this. If you do, I can assign you to "reserve" this.

@westnordost westnordost added the help wanted help by contributors is appreciated; might be a good first contribution for first-timers label Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted help by contributors is appreciated; might be a good first contribution for first-timers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants