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

Kolibri debug take 2 #127

Merged
merged 2 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,17 @@ component of the project's version number.
When Kolibri is run in debug mode, it uses debug logging for its modules
and enables Django's debug mode. To enable Kolibri debug mode, start
kolibri-daemon with the `KOLIBRI_DEBUG` environment variable set to `1`.
Since the daemon is typically D-Bus activated, the best way to
accomplish this when using the flatpak is set the environment variable
in an override:

```
flatpak override --env=KOLIBRI_DEBUG=1 org.endlessos.Key.Devel
```

To enable debug logging for database queries, the
`KOLIBRI_DEBUG_LOG_DATABASE` environment variable can be set in the same
way as the `KOLIBRI_DEBUG` environment variable.

#### Web inspector

Expand Down
10 changes: 7 additions & 3 deletions src/kolibri_daemon/kolibri_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ def init_kolibri(**kwargs):
for plugin_name in OPTIONAL_PLUGINS:
_enable_kolibri_plugin(plugin_name, optional=True)

# Use the KOLIBRI_DEBUG environment variable for the Kolibri debug
# initialization value. This is basically equivalent to how "kolibri
# start" works.
# Use the KOLIBRI_DEBUG and KOLIBRI_DEBUG_LOG_DATABASE environment
# variables for the Kolibri debug initialization values. This is
# basically equivalent to how "kolibri start" works.
if "debug" not in kwargs:
kwargs["debug"] = getenv_as_bool("KOLIBRI_DEBUG", default=False)
if "debug_database" not in kwargs:
kwargs["debug_database"] = getenv_as_bool(
"KOLIBRI_DEBUG_LOG_DATABASE", default=False
)

initialize(**kwargs)

Expand Down