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

docs: add structlog config #1031

Merged
merged 5 commits into from
Jan 12, 2025
Merged

Conversation

kasteph
Copy link
Contributor

@kasteph kasteph commented Mar 28, 2024

Closes #1030

Successful PR Checklist:

  • Tests
    • (not applicable?)
  • Documentation
    • (not applicable?)

PR label(s):

@kasteph kasteph requested a review from a team as a code owner March 28, 2024 17:46
@github-actions github-actions bot added the PR type: documentation 📚 Contains documentation updates label Mar 28, 2024
Copy link

github-actions bot commented Mar 28, 2024

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  procrastinate
  worker.py
Project Total  

This report was generated by python-coverage-comment-action

Copy link
Member

@ewjoachim ewjoachim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.

So you were mentioning in the issue that it wasn't working as intended ? Were you able to fix that ?

I wonder if we should, somehow, test that. Maybe install this in a procrastinate_demo project ? Do you have an opinion ? (I'm not saying you have to do this on the PR (but you may), just asking. Your PR may should get merged at some point, even without that)

docs/howto/production/logging.md Outdated Show resolved Hide resolved

A minimal configuration would look like:

```py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I think we're using python elsewhere, rather than py)

kasteph and others added 2 commits April 1, 2024 11:22
Co-authored-by: Joachim Jablon <[email protected]>
@ewjoachim
Copy link
Member

Hm, I've tried your code and it hasn't worked on the demo so far. I'll try to share a complete traceback later, but has it been working for you ?

@kasteph
Copy link
Contributor Author

kasteph commented Apr 8, 2024

Hm, I've tried your code and it hasn't worked on the demo so far. I'll try to share a complete traceback later, but has it been working for you ?

Yes, it has on a bigger project. Did you try the minimal config or the one from the structlog docs?

@ewjoachim
Copy link
Member

ewjoachim commented Apr 9, 2024

I tried the one from your PR, and tried to put it as-is in the sync demo.

@ewjoachim
Copy link
Member

ewjoachim commented Aug 11, 2024

(Hm, I'm sorry, I think this PR went a bit out of sight. We should try and put this back on the table at some point, though I can't make specific commitment. Just wanted to state that I'm sorry we didn't put enough work yet to match the effort you made crafting the PR. But it's not lost.)

@andrew-womeldorf
Copy link
Contributor

I tried the configuration in the PR, and it also hasn't worked for me.

  • structlog v24.4.0
  • procrastinate v2.15.1
--- Logging error ---
Traceback (most recent call last):
  File "/path/to/PYTHON/lib/python3.12/logging/__init__.py", line 1160, in emit
    msg = self.format(record)
          ^^^^^^^^^^^^^^^^^^^
  File "/path/to/PYTHON/lib/python3.12/logging/__init__.py", line 999, in format
    return fmt.format(record)
           ^^^^^^^^^^^^^^^^^^
  File "/path/to/PROJECT/.venv/lib/python3.12/site-packages/structlog/stdlib.py", line 1098, in format
    ed = p(logger, meth_name, cast(EventDict, ed))
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/path/to/PROJECT/.venv/lib/python3.12/site-packages/structlog/stdlib.py", line 1142, in remove_processors_meta
    del event_dict["_record"]
        ~~~~~~~~~~^^^^^^^^^^^
TypeError: 'tuple' object does not support item deletion
Call stack:
  File "<string>", line 1, in <module>
  File "/path/to/PYTHON/lib/python3.12/multiprocessing/spawn.py", line 122, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/path/to/PYTHON/lib/python3.12/multiprocessing/spawn.py", line 135, in _main
    return self._bootstrap(parent_sentinel)
  File "/path/to/PYTHON/lib/python3.12/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/path/to/PYTHON/lib/python3.12/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/path/to/PROJECT/.venv/lib/python3.12/site-packages/uvicorn/_subprocess.py", line 80, in subprocess_started
    target(sockets=sockets)
  File "/path/to/PROJECT/.venv/lib/python3.12/site-packages/uvicorn/server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/path/to/PYTHON/lib/python3.12/asyncio/runners.py", line 193, in run
    with Runner(debug=debug, loop_factory=loop_factory) as runner:
  File "/path/to/PYTHON/lib/python3.12/asyncio/runners.py", line 58, in __enter__
    self._lazy_init()
  File "/path/to/PYTHON/lib/python3.12/asyncio/runners.py", line 137, in _lazy_init
    self._loop = events.new_event_loop()
  File "/path/to/PYTHON/lib/python3.12/asyncio/events.py", line 823, in new_event_loop
    return get_event_loop_policy().new_event_loop()
  File "/path/to/PYTHON/lib/python3.12/asyncio/events.py", line 720, in new_event_loop
    return self._loop_factory()
  File "/path/to/PYTHON/lib/python3.12/asyncio/unix_events.py", line 64, in __init__
    super().__init__(selector)
  File "/path/to/PYTHON/lib/python3.12/asyncio/selector_events.py", line 64, in __init__
    logger.debug('Using selector: %s', selector.__class__.__name__)
Message: 'Using selector: %s'
Arguments: ('KqueueSelector',)

docs/howto/production/logging.md Outdated Show resolved Hide resolved
docs/howto/production/logging.md Outdated Show resolved Hide resolved
ewjoachim and others added 2 commits January 12, 2025 16:56
@ewjoachim ewjoachim enabled auto-merge January 12, 2025 15:56
@ewjoachim
Copy link
Member

Thank you very much :) Sorry for the delay, but I'm thrilled to have this merged, at last :)

@ewjoachim ewjoachim merged commit 0ea6120 into procrastinate-org:main Jan 12, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR type: documentation 📚 Contains documentation updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to configure with structlog?
3 participants