Non-blocking logging
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
Research direction
Start by reading the Python logging cookbook section linked in the issue and structlog’s documentation on logger configuration and handlers. The issue does not name a code entry point or test, so first trace how structlog integrates with standard logging and identify where a queue-based, non-blocking setup could fit. Done means establishing whether structlog supports this setup and documenting or implementing a clear way to use it.
Written by the indexing model from the issue text.
Description
Hi with the python standard logging library, we are able to setup a queue and a listener so that logs are non blocking. Are we able to setup something similar with structlog?
Example from the standard logging library docs:
que = queue.Queue(-1) # no limit on size
queue_handler = QueueHandler(que)
handler = logging.StreamHandler()
listener = QueueListener(que, handler)
root = logging.getLogger()
root.addHandler(queue_handler)
formatter = logging.Formatter('%(threadName)s: %(message)s')
handler.setFormatter(formatter)
listener.start()
# The log output will display the thread which generated
# the event (the main thread) rather than the internal
# thread which monitors the internal queue. This is what
# you want to happen.
root.warning('Look out!')
listener.stop()
Python standard logging library reference:
https://docs.python.org/3/howto/logging-cookbook.html#dealing-with-handlers-that-block
- Dominant language
- Python
- Stars
- 5k
- Forks
- 302
- Avg merge
- 17m
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hynek/structlog
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Transform examples in docs into included source filesPossibly taken @alexchen-sys claimed this 97 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
waiting for feedback
Difficulty 3/5 1-2 days Newbie friendliness 48/100
Similar issues
-
infrastructure
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
khuisman/mcp-gee-sweet#1152 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
backroom bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ditto-assistant/ditto-subnet#3069 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
open-webui/open-webui#32901 · 1 comment ·
Maintainers usually reply within 1 day
-
0.3.3 bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day