classification
Title: Allow easy display of local variables in log messages?
Type: Stage:
Components: Versions: Python 3.5
process
Status: open Resolution:
Dependencies: 22936 Superseder:
Assigned To: Nosy List: cvrebert, ncoghlan, rbcollins
Priority: normal Keywords:

Created on 2015-03-06 02:12 by ncoghlan, last changed 2015-08-26 00:33 by cvrebert.

Messages (2)
msg237319 - (view) Author: Nick Coghlan (ncoghlan) * (Python committer) Date: 2015-03-06 02:12
Issue #22936 added support for easily displaying local variables in tracebacks to the unittest and traceback modules.

Would it be worth also making this capability readily available in the logging APIs that display traceback messages?

The main argument against it is that automatically logging local variables in tracebacks is a *really* good way to introduce sensitive information leaks into your log messages. "Safe repr" type objects (which automatically mask sensitive details in __repr__()) can mitigate this, but we don't provide such an object in the standard library (not even for bytes, bytearray or str, which are the typical containers for potentially sensitive data like passwords).
msg237323 - (view) Author: Robert Collins (rbcollins) * (Python committer) Date: 2015-03-06 02:27
Yes, for debugging etc this can be very useful. I suggest further extending the new traceback interface to allow a filtering/transform hook of some sort, to allow folk more granular control than just repr overloading.
History
Date User Action Args
2015-08-26 00:33:02cvrebertsetnosy: + cvrebert
2015-03-06 02:27:44rbcollinssetnosy: + rbcollins
messages: + msg237323
2015-03-06 02:13:00ncoghlansetdependencies: + traceback module has no way to show locals
2015-03-06 02:12:46ncoghlancreate