Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Question about configuring show_locals for json output #626

Closed
dineshbvadhia opened this issue Jun 10, 2024 · 1 comment
Closed

Question about configuring show_locals for json output #626

dineshbvadhia opened this issue Jun 10, 2024 · 1 comment

Comments

@dineshbvadhia
Copy link

dineshbvadhia commented Jun 10, 2024

Is this the correct configuration for show_locals=False with json output?

structlog.configure(
    cache_logger_on_first_use=True,
    wrapper_class=structlog.make_filtering_bound_logger(logging.INFO),
    processors=[
        structlog.contextvars.merge_contextvars,
        structlog.processors.add_log_level,
        structlog.processors.format_exc_info,
        structlog.processors.TimeStamper(fmt="iso", utc=True),
        structlog.processors.ExceptionRenderer(
            structlog.tracebacks.ExceptionDictTransformer(show_locals=False)
        ),
        structlog.processors.JSONRenderer(serializer=orjson.dumps),
    ],
    logger_factory=structlog.BytesLoggerFactory(),
)

logger = structlog.get_logger()
@hynek hynek mentioned this issue Jun 26, 2024
9 tasks
@sscherfke
Copy link
Contributor

Yes, this looks right. With #627 you will have even more options. :-)

@hynek hynek closed this as not planned Won't fix, can't repro, duplicate, stale Jul 10, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants