← ClaudeAtlas

structloglisted

Structured logging for Python applications with context support and powerful processors
aiskillstore/marketplace · ★ 329 · AI & Automation · score 82
Install: claude install-skill aiskillstore/marketplace
# Structlog Skill ## Quick Start ```python import structlog # Basic usage log = structlog.get_logger() log.info("hello, %s!", "world", key="value", more_than_strings=[1, 2, 3]) ``` ## Common Patterns ### Basic Configuration ```python import structlog structlog.configure( processors=[ structlog.contextvars.merge_contextvars, structlog.processors.add_log_level, structlog.processors.StackInfoRenderer(), structlog.dev.set_exc_info, structlog.processors.TimeStamper(fmt="%Y-%m-%d %H:%M:%S", utc=False), structlog.dev.ConsoleRenderer() ], wrapper_class=structlog.make_filtering_bound_logger(logging.NOTSET), context_class=dict, logger_factory=structlog.PrintLoggerFactory(), cache_logger_on_first_use=False ) ``` ### JSON Logging ```python import structlog # Configure for JSON output structlog.configure( processors=[structlog.processors.JSONRenderer()] ) log = structlog.get_logger() log.info("Processing request", request_id="req-123", user_id=456) # Output: {"event": "Processing request", "request_id": "req-123", "user_id": 456} ``` ### Standard Library Integration ```python import logging import structlog # Configure standard logging logging.basicConfig( format="%(message)s", stream=sys.stdout, level=logging.INFO ) # Configure structlog to use standard library structlog.configure( processors=[ structlog.stdlib.filter_by_level, structlog.stdlib.add_logger_name,