Description: Briefly describe the changes in this pull request.
Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
Documentation: Have you updated relevant documentation?
Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
Description
Introduce Python logging and migrate all print() statements to it. To mirror current functionality, logging doesn't use a file, only sys.stdout. A global var GLOBAL_LOG_LEVEL and any of following like OLLAMA_LOG_LEVEL=DEBUG can be set: log_sources = ["AUDIO", "CONFIG", "DB", "IMAGES", "LITELLM", "MAIN", "MODELS", "OLLAMA", "OPENAI", "RAG"]. Note that this is additionally beneficial as it affects any 3rd party imports that use the Python logging module including LITELLM.
Changelog Entry
First commit
Added
Introduce Python import logging functionality.
Fixed
Sensitive log items like the POST data and password hash now require DEBUG logging. Default is INFO.
Changed
Everywhere using print()
Removed
Replaced print() statements with log. statements.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/1237
**Author:** [@ghost](https://github.com/ghost)
**Created:** 3/20/2024
**Status:** ✅ Merged
**Merged:** 3/24/2024
**Merged by:** [@tjbck](https://github.com/tjbck)
**Base:** `dev` ← **Head:** `debug_print`
---
### 📝 Commits (3)
- [`e6dd0bf`](https://github.com/open-webui/open-webui/commit/e6dd0bfbe0a3cd3eff799146332084fc70e00cb5) Migrate to python logging module with env var control.
- [`f74f2ea`](https://github.com/open-webui/open-webui/commit/f74f2ea76517041bab1e245650a4690793fe22f9) Merge conflicts
- [`371dfc1`](https://github.com/open-webui/open-webui/commit/371dfc11434ad009e299d5cc223b198b781709a6) Merge branch 'dev' into debug_print
### 📊 Changes
**15 files changed** (+174 additions, -82 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/apps/audio/main.py` (+8 -4)
📝 `backend/apps/images/main.py` (+7 -3)
📝 `backend/apps/litellm/main.py` (+7 -2)
📝 `backend/apps/ollama/main.py` (+37 -34)
📝 `backend/apps/openai/main.py` (+13 -8)
📝 `backend/apps/rag/main.py` (+12 -9)
📝 `backend/apps/rag/utils.py` (+7 -3)
📝 `backend/apps/web/internal/db.py` (+5 -2)
📝 `backend/apps/web/models/auths.py` (+7 -2)
📝 `backend/apps/web/models/documents.py` (+7 -2)
📝 `backend/apps/web/models/tags.py` (+9 -4)
📝 `backend/apps/web/routers/chats.py` (+7 -2)
📝 `backend/apps/web/routers/users.py` (+6 -1)
📝 `backend/config.py` (+34 -4)
📝 `backend/main.py` (+8 -2)
</details>
### 📄 Description
## Pull Request Checklist
- [X] **Description:** Briefly describe the changes in this pull request.
- [X] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description.
- [ ] **Documentation:** Have you updated relevant documentation?
- [X] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation?
---
## Description
Introduce Python `logging` and migrate all `print()` statements to it. To mirror current functionality, logging doesn't use a file, only `sys.stdout`. A global var `GLOBAL_LOG_LEVEL` and any of following like `OLLAMA_LOG_LEVEL=DEBUG` can be set: `log_sources = ["AUDIO", "CONFIG", "DB", "IMAGES", "LITELLM", "MAIN", "MODELS", "OLLAMA", "OPENAI", "RAG"]`. Note that this is additionally beneficial as it affects any 3rd party imports that use the Python logging module including LITELLM.
---
### Changelog Entry
First commit
### Added
- Introduce Python `import logging` functionality.
### Fixed
- Sensitive log items like the POST data and password hash now require DEBUG logging. Default is INFO.
### Changed
- Everywhere using `print()`
### Removed
- Replaced `print()` statements with `log.` statements.
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/1237
Author: @ghost
Created: 3/20/2024
Status: ✅ Merged
Merged: 3/24/2024
Merged by: @tjbck
Base:
dev← Head:debug_print📝 Commits (3)
e6dd0bfMigrate to python logging module with env var control.f74f2eaMerge conflicts371dfc1Merge branch 'dev' into debug_print📊 Changes
15 files changed (+174 additions, -82 deletions)
View changed files
📝
backend/apps/audio/main.py(+8 -4)📝
backend/apps/images/main.py(+7 -3)📝
backend/apps/litellm/main.py(+7 -2)📝
backend/apps/ollama/main.py(+37 -34)📝
backend/apps/openai/main.py(+13 -8)📝
backend/apps/rag/main.py(+12 -9)📝
backend/apps/rag/utils.py(+7 -3)📝
backend/apps/web/internal/db.py(+5 -2)📝
backend/apps/web/models/auths.py(+7 -2)📝
backend/apps/web/models/documents.py(+7 -2)📝
backend/apps/web/models/tags.py(+9 -4)📝
backend/apps/web/routers/chats.py(+7 -2)📝
backend/apps/web/routers/users.py(+6 -1)📝
backend/config.py(+34 -4)📝
backend/main.py(+8 -2)📄 Description
Pull Request Checklist
Description
Introduce Python
loggingand migrate allprint()statements to it. To mirror current functionality, logging doesn't use a file, onlysys.stdout. A global varGLOBAL_LOG_LEVELand any of following likeOLLAMA_LOG_LEVEL=DEBUGcan be set:log_sources = ["AUDIO", "CONFIG", "DB", "IMAGES", "LITELLM", "MAIN", "MODELS", "OLLAMA", "OPENAI", "RAG"]. Note that this is additionally beneficial as it affects any 3rd party imports that use the Python logging module including LITELLM.Changelog Entry
First commit
Added
import loggingfunctionality.Fixed
Changed
print()Removed
print()statements withlog.statements.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.