summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRory Geoghegan <rory.geoghegan@ecometrica.com>2013-11-04 12:45:41 -0500
committerRory Geoghegan <rory.geoghegan@ecometrica.com>2013-11-04 12:45:41 -0500
commit025f358b120c8e9fd0cb89d4cd9589623da25ad4 (patch)
treebb310fad9bc549f2bf6a1a8f8ef8247effe80fad
parent776fc033b95f7fc39bc8e906c5dcefc6681e2082 (diff)
downloadraven-025f358b120c8e9fd0cb89d4cd9589623da25ad4.tar.gz
Fixed bug in logging.py where messages were not being printed to stderr.
Also took the opportunity to port the print statments in logbook.py to python3.
-rw-r--r--raven/handlers/logbook.py9
-rw-r--r--raven/handlers/logging.py8
2 files changed, 9 insertions, 8 deletions
diff --git a/raven/handlers/logbook.py b/raven/handlers/logbook.py
index 7f812b3..bf9ca7f 100644
--- a/raven/handlers/logbook.py
+++ b/raven/handlers/logbook.py
@@ -7,6 +7,7 @@ raven.handlers.logbook
"""
from __future__ import absolute_import
+from __future__ import print_function
import logbook
import sys
@@ -42,14 +43,14 @@ class SentryHandler(logbook.Handler):
try:
# Avoid typical config issues by overriding loggers behavior
if record.channel.startswith(('sentry.errors', 'raven')):
- print >> sys.stderr, to_string(self.format(record))
+ print(to_string(self.format(record)), file=sys.stderr)
return
return self._emit(record)
except Exception:
- print >> sys.stderr, "Top level Sentry exception caught - failed creating log record"
- print >> sys.stderr, to_string(record.msg)
- print >> sys.stderr, to_string(traceback.format_exc())
+ print("Top level Sentry exception caught - failed creating log record", file=sys.stderr)
+ print(to_string(record.msg), file=sys.stderr)
+ print(to_string(traceback.format_exc()))
try:
self.client.captureException()
diff --git a/raven/handlers/logging.py b/raven/handlers/logging.py
index b8729e8..84b3cf0 100644
--- a/raven/handlers/logging.py
+++ b/raven/handlers/logging.py
@@ -58,14 +58,14 @@ class SentryHandler(logging.Handler, object):
self.format(record)
if not self.can_record(record):
- print(to_string(record.message), sys.stderr)
+ print(to_string(record.message), file=sys.stderr)
return
return self._emit(record)
except Exception:
- print("Top level Sentry exception caught - failed creating log record", sys.stderr)
- print(to_string(record.msg), sys.stderr)
- print(to_string(traceback.format_exc()), sys.stderr)
+ print("Top level Sentry exception caught - failed creating log record", file=sys.stderr)
+ print(to_string(record.msg), file=sys.stderr)
+ print(to_string(traceback.format_exc()), file=sys.stderr)
def _get_targetted_stack(self, stack):
# we might need to traverse this multiple times, so coerce it to a list