We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Originally posted by kasteph March 27, 2024 I am following the code snippet here and the docs. I have something like this:
import logging import sys import structlog class ProcrastinateLogFilter(logging.Filter): _reserved_log_keys = frozenset( """args asctime created exc_info exc_text filename funcName levelname levelno lineno module msecs message msg name pathname process processName relativeCreated stack_info thread threadName""".split() ) def filter(self, record: logging.LogRecord): record.procrastinate = {} for key, value in vars(record).items(): if not key.startswith("_") and key not in self._reserved_log_keys | { "procrastinate" }: record.procrastinate[key] = value # type: ignore return True def configure_logging(env_settings) -> bool: logging.getLogger("uvicorn.error").disabled = True logging.getLogger("uvicorn.access").disabled = True logging.getLogger("procrastinate").addFilter(ProcrastinateLogFilter) logging.basicConfig(format="%(message)s", stream=sys.stdout, level=env_settings.log_level) renderer = structlog.processors.JSONRenderer() if env_settings.prod else structlog.dev.ConsoleRenderer() structlog.configure( processors=[ structlog.stdlib.add_log_level, structlog.contextvars.merge_contextvars, structlog.processors.StackInfoRenderer(), structlog.dev.set_exc_info, structlog.processors.TimeStamper(fmt="iso", utc=True), renderer, ], logger_factory=structlog.PrintLoggerFactory(),
However, this doesn't actually work. Can someone share a working example of configuring with structlog?
structlog
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Discussed in #1028
Originally posted by kasteph March 27, 2024
I am following the code snippet here and the docs. I have something like this:
However, this doesn't actually work. Can someone share a working example of configuring with
structlog
?The text was updated successfully, but these errors were encountered: