Skip to content

Censor API token from logging data #239

@fisher60

Description

@fisher60

Summary

Login requests to the Friendo API are being removed from logging as a hotfix. We would still like to log these requests, but with the token censored.

class LoginTokenLoggingFilter(logging.Filter):
"""Logging filter to remove api token from logging for friendo api requests."""
def filter(self, record: logging.LogRecord) -> bool:
"""Returns False if login token is in logging record."""
return "token" not in record.getMessage()

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions