diff --git a/doc/README.md b/doc/README.md index 603df7f249..fb585d210f 100644 --- a/doc/README.md +++ b/doc/README.md @@ -18,6 +18,7 @@ [Working on PR together with QA team](pipeline_process.md) +[Debugging](debugging.md) ## Testing diff --git a/doc/codebase-structure-and-guidelines.md b/doc/codebase-structure-and-guidelines.md index 748feb110e..e4ec779c4c 100644 --- a/doc/codebase-structure-and-guidelines.md +++ b/doc/codebase-structure-and-guidelines.md @@ -91,30 +91,11 @@ These guidelines make db.cljs namespaces the place to go when making changes to - If manual QA is not needed but all tests don't pass, you can ping @churik or @Serhy to confirm that failed E2E tests are not unrelated. -## Enabling debug logs -Calls to `log/debug` will not be printed to the console by default. It can be enabled under "Advanced settings" in the app: - -![Enable Debug Logs](images/codebase-structure-and-guidelines/log-settings.png) - ## Translations The app relies on system locale to select a language from the [list of supported languages](https://github.com/status-im/status-mobile/blob/bda73867471cf2bb8a68b1cc27c9f94b92d9a58b/src/status_im/i18n_resources.cljs#L9). It falls back to English in cash the system locale is not supported. We use Lokalise App to manage [translations](https://translate.status.im/). In case you need to add/remove a key to translations, you only need to change `en.json`. Missing keys fallback to `en.json`. The actual translations will be added by Lokalise. -## re-frisk -re-frisk is a state visualization tool written by our very own Andrey (@flexsurfer). To start re-frisk, execute the following command: -```bash -$ yarn shadow-cljs run re-frisk-remote.core/start -``` - -or you can also use make: - -```bash -$ make run-re-frisk -``` - -A server will be started at http://localhost:4567. It might show "not connected" at first. Don't worry and just start using the app. The events and state will populate. - ## Merging approved PRs We don't Github's UI to merge. Instead `./scripts/merge-pr.sh` is used to sign and merge PR to `develop`. You first need to enable [GPG signing on you commits](https://github.com/status-im/status-mobile/blob/develop/STARTING_GUIDE.md#configure-gpg-keys-for-signing-commits). diff --git a/doc/debugging.md b/doc/debugging.md new file mode 100644 index 0000000000..de23494159 --- /dev/null +++ b/doc/debugging.md @@ -0,0 +1,64 @@ +# Debugging + +## Inspecting re-frame with re-frisk +`re-frisk` is a state visualization tool written by our very own Andrey (@flexsurfer). With its help you can inspect the current state of app-db, watch event, etc. + +![re-frisk](images/debugging/re-frisk.png) + +To start `re-frisk`, execute the following command: +```bash +$ yarn shadow-cljs run re-frisk-remote.core/start +``` + +or you can also use make: + +```bash +$ make run-re-frisk +``` + +A server will be started at http://localhost:4567. It might show "not connected" at first. Don't worry and just start using the app. The events and state will populate. + +More details about re-frisk are on the [project page](https://github.com/flexsurfer/re-frisk). + +## Enabling debug logs +Calls to `log/debug` will not be printed to the console by default. It can be enabled under "Advanced settings" in the app: + +![Enable Debug Logs](images/debugging/log-settings.png) + + +## Checking status-go logs +While status mobile works it saves logs from `status-go` to `geth.log` file. + + +### Checking logs from physical device +To obtain `geth.log` from physical device you need to shake it and in an opened menu select "Share logs". + +![Share logs](images/debugging/share-logs.jpeg) + + +### Checking logs from iOS Simulator +When developing with iOS simulator it is more convenient to see the `geth.log` updates in real-time. +To do this: +- open Activity Monitor +- find the "StatusIm" app and doubleclick it +- in the opened window select "Open files and ports" and find the full path to `geth.log` (note that it won't appear until you login to Status app) + +![geth.log path](images/debugging/geth-path.png) + + +## Tips +### From @ilmotta: + +Something I find extremely convenient for Android is to use `adb` to tail logs. I don't use macOS so I don't know if the iOS simulator offers a CLI interface with the same capabilities. + +But here's what I use for example: + +``` + adb shell tail -n 10 -f /storage/emulated/0/Android/data/im.status.ethereum.debug/files/Download/geth.log | grep 'waku.relay' +``` + +Also to inspect logs in a more flexible manner, instead of the strict output from `make run-metro`, I prefer `adb logcat`. Combined with enabling status-mobile logs in debug by default plus filtering the logs to only what I care during development, I find this helps me inspect the app without running re-frisk because with the debug log level I can already see which events are dispatched (one of the features I like the most from re-frisk). + +``` +adb logcat | grep 'ReactNativeJS\|StatusModule\|GoLog' +``` diff --git a/doc/images/debugging/geth-path.png b/doc/images/debugging/geth-path.png new file mode 100644 index 0000000000..0fa34ec11f Binary files /dev/null and b/doc/images/debugging/geth-path.png differ diff --git a/doc/images/codebase-structure-and-guidelines/log-settings.png b/doc/images/debugging/log-settings.png similarity index 100% rename from doc/images/codebase-structure-and-guidelines/log-settings.png rename to doc/images/debugging/log-settings.png diff --git a/doc/images/debugging/re-frisk.png b/doc/images/debugging/re-frisk.png new file mode 100644 index 0000000000..a34a100728 Binary files /dev/null and b/doc/images/debugging/re-frisk.png differ diff --git a/doc/images/debugging/share-logs.jpeg b/doc/images/debugging/share-logs.jpeg new file mode 100644 index 0000000000..b56d3579b1 Binary files /dev/null and b/doc/images/debugging/share-logs.jpeg differ