feat(linux): improve logging in ibus-engine-keyman
- Dominant language
- Pascal
- Stars
- 534
- Forks
- 143
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 113
Description
Currently we mainly use `g_message` (and a few `g_debug`) calls for logging in ibus-keyman. The output of `g_message` is usually not visible unless you explicitly start `ibus-engine-keyman`. However, it would be better if the user would have to explicitly request logging.
We should change most `g_message` to `g_debug` and might want to change the existing `g_debug` to use a separate log domain[1] so that we can distinguish between different levels of logging.
We could define our own log domain: `-DG_LOG_DOMAIN=keyman` (and use a separate domain for the existing `g_debug` calls, e.g. `keyman-debug`).
We might want to add the parameters `--verbose` (which would output from existing `g_message`) and `--debug` (which would additionally output from existing `g_debug`) to `ibus-engine-keyman`. The program then has to set (or append) the `G_MESSAGES_DEBUG` environment variable internally.
The user can then enable logging by either starting `ibus-engine-keyman` with `--verbose` or `--debug`, or by setting the environment variable `G_MESSAGES_DEBUG` to `keyman` or `keyman-debug`, e.g. `export G_MESSAGES_DEBUG=keyman,keyman-debug`.
See:
- [1] https://stackoverflow.com/a/69306792
- https://docs.gtk.org/glib/running.html
- https://docs.gtk.org/glib/logging.html
Related: #12703
Contributor guide
Assessment
This issue has not been assessed yet.