Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

DropEvent does not work in foreign_pre_chain

Open
#113 3 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

  • #115 by @gilbsgilbs — closed without merging

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
32/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

The report reproduces the issue with the documented standard-library formatter example and a processor that raises DropEvent in pre_chain; start by reading that example and the three issue comments. Check the handling attempted in linked pull request #115 for context. Done means the log is skipped without propagating DropEvent, or the documentation clearly explains the limitation and recommends a stdlib Filter.

Written by the indexing model from the issue text.

Description

stdlib
Steps to reproduce
  1. Take this example from the doc.
  2. Append a processor that raises DropEvent in pre_chain.
  3. Run the example.
Expected behaviour

The log should be skipped.

Actual behaviour

Raises DropEvent; The exception is not caught.

Comments

I don't know if this is really expected or not. There should be at least a disclaimer in the documentation that states clearly that you shouldn't throw DropEvent in pre_chains processors, and you should instead write a stdlib Filter.

However, I reckon there is a way to handle the DropEvent in pre_chain. We could declare a custom Handler that proxies everything to the StreamHandler (or whatever handler is configured), except that we catch/ignore the DropEvent exception in the overidden emit method. This solution implies a tiny overhead on each log, since we have to forward each log entry to the underlying handler.

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hynek/structlog

All issues in hynek/structlog

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.