plone / plone.protect

HTTP protection utilities for the Plone CMS
https://pypi.org/project/plone.protect/
7 stars 8 forks source link

Fix logging to no longer write to stdout. #63

Closed jone closed 7 years ago

jone commented 7 years ago

The print_stack() function does actually print the stack (to stdout), not return it. What we want to do here is use format_stack so that we can include the stack in the message.

>>> import traceback
>>> value = traceback.print_stack()
  File "<stdin>", line 1, in <module>
>>> print value
None
>>> value = traceback.format_stack()
>>> print value
['  File "<stdin>", line 1, in <module>\n']