67 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
0
answers
129
views
structlog enforce Wrapped logger type with mypy
I wanted to override the structlog logger for the whole application, by doing this:
import enum
from collections.abc import Iterable
import structlog
from structlog.typing import Processor
from ...
1
vote
1
answer
230
views
How to limit the length of or suppress local variables in structlog exception reports?
I'm using structlog in an application. When I use it to render an exception:
logger = structlog.get_logger()
logger.exception("boom")
I get the expected pretty exception report. However ...
0
votes
1
answer
67
views
Get package level logs into webservice between logging and structlog
So the situation is the following:
multiple internal packages written in python which do rarely log and if only use, these use the basic python logging module, since this is as far as I have read ...
1
vote
1
answer
218
views
How to Include a Message Field in Structlog Logs and Best Practices for ElasticSearch Integration
I'm working on a Django project where logging is critical, and I'm using structlog to format and manage logs. The plan is to send these logs to ElasticSearch. However, I've encountered an issue: the ...
1
vote
1
answer
362
views
Use `structlog` in a library while respecting `stdlib` log configuration
I'm looking to use structlog in a Python library, but would also like to transparently support the logging configuration set up by a containing application. In particular:
if a log level is set (e.g. ...
0
votes
0
answers
960
views
Using structlog with Datadog
We're using the logging module from the stdlib to send logs from our Django app to Datadog and we have customised our logging based on django-datadog-logger
We're exploring a move to structlog, and I ...
0
votes
1
answer
669
views
How to use structlog with logfmt formatted logs in python?
I want to print out root logs in logfmt format. structlog also should print logs in the same format. I tried this example for JSON format and looks like it doesn't work with logfmt.
Here is a first ...
1
vote
1
answer
435
views
Adapt context to log level in structlog
A common need when logging events is to provide more or less information depending on the log level. Consider the example below where some noisy payload should be included in the logs only if the log ...
0
votes
1
answer
600
views
Are passed structlog loggers process-safe?
I want to use structlog in a multiprocess application in python. The processes shall be able to log as well. Hence I need to ensure that writes to any I/O are process-safe.
Python standard logging ...
1
vote
0
answers
125
views
Sending Structured Logs to Pytest and Pretty-Printed Logs to the Console
I am writing a Pytest suite that generates a lot of logs with structured data from Structlog, but they are very noisy when printed to the console. I use the JSON report plugin, and I want to dump the ...
1
vote
2
answers
722
views
structlog with Celery
I have a working celery app. I want to add structured logging to it.
A complete working example would be hard to provide, so let me demostrate:
import structlog
import logging
logging.config....
2
votes
1
answer
638
views
How to configure different loggers separately in structlog?
structlog.configure() seems to be the global setting. I need to create two different loggers with different settings.Hope someone can give me the right solution, thanks!
logger1 = structlog.get_logger(...
0
votes
1
answer
389
views
How can you suppress logging for a block of code in structlog?
I am writing a test of an error condition, checking that it occurs and is handled. I don't want the test output to be spammed with error messages for errors that have been deliberately provoked and ...
1
vote
0
answers
446
views
How to use two renderers with structlog?
Would anyone of you know how to use two different renderers in structlog?
I'd like to use ConsoleRenderer with colors and nice formatting in console (on DEBUG) and also log same messages in log, ...
0
votes
1
answer
718
views
Failing to use bound_contextvars with complex logger configuration because of missing structlog.contextvars.merge_contextvars processor
This
import structlog
from structlog.contextvars import bound_contextvars
if __name__=="__main__":
log = structlog.getLogger(__name__)
with bound_contextvars(frame_id="ADA",...