Skip to content

Commit

Permalink
minor logging optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
snarfed committed Aug 2, 2024
1 parent ac77c73 commit 3492551
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion flask_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def decorator(*args, **kwargs):
if CLOUD_TASKS_QUEUE_HEADER not in request.headers:
return 'Internal only', 401

logger.info(f"Running {request.headers.get('X-AppEngine-QueueName')} task {request.headers.get('X-AppEngine-TaskName')}")
logger.info(f"Task {request.headers.get('X-AppEngine-TaskName')}")

return fn(*args, **kwargs)

Expand Down
13 changes: 5 additions & 8 deletions util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1789,14 +1789,11 @@ def requests_post_with_redirects(url, *args, **kwargs):


def _prune(kwargs):
pruned = dict(kwargs)

headers = pruned.get('headers')
if headers:
pruned['headers'] = {k: '...' for k in headers}

return {k: v for k, v in list(pruned.items())
if k not in ('allow_redirects', 'stream', 'timeout')}
return {
k: v for k, v in list(kwargs.items())
if k not in ('allow_redirects', 'auth', 'gateway', 'headers',
'stream', 'timeout')
}


@cached(follow_redirects_cache, lock=follow_redirects_cache_lock,
Expand Down

0 comments on commit 3492551

Please sign in to comment.