feat: structured logging helpers + get_issue instrumentation (#14) #24
Reference in New Issue
Block a user
Delete Branch "feat/get-issue-debug-logging"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #14.
Adds reusable, secret-safe structured-logging helpers and instruments
get_issueso nullable-field parsing (the class of failure behind #13) is diagnosable.Helpers (
logging_utils)log_event(logger, level, event, **context)— emit a named event with acontextmapping; keys inSENSITIVE_CONTEXT_KEYS(token,authorization,password, …) are masked as***.log_nullable_field(logger, event, field, value)— record whether a parsed field isNoneplus its runtime type, without dumping contents.sanitize_context(...)— shared masking primitive.contextinto the payload.Instrumentation
get_issue_toolemitsget_issue.start,get_issue.payload_shape, andget_issue.field_check(labels/assignees/user) atDEBUG. Silent unlessLOG_LEVEL=DEBUG.Scope note
log_exceptionfrom the issue's suggestion was intentionally omitted: logging an exception message conflicts with the project's "no exception-detail leakage" posture, so only the exception type is ever logged (unchanged behaviour).Tests & docs
tests/test_logging_utils.py: helpers, masking, formatter context, and theget_issueinstrumentation.docs/observability.mddocuments the pattern and its reuse for other parsing-heavy endpoints.baacd9e9b5tof53e1a3a5a