Skip to content

Commit ffe4c5d

Browse files
committed
Remove support for logbook.
If you were relying on this feature, it should be quite easy to implement it in a third-party panel, and we'll reference it in the documentation. Fix #478.
1 parent a7dbc61 commit ffe4c5d

File tree

2 files changed

+5
-32
lines changed

2 files changed

+5
-32
lines changed

debug_toolbar/panels/logging.py

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -68,40 +68,13 @@ def emit(self, record):
6868
self.collector.add_record(record)
6969

7070

71+
# We don't use enable/disable_instrumentation because logging is global.
72+
# We can't add thread-local logging handlers. Hopefully logging is cheap.
73+
7174
collector = LogCollector()
7275
logging_handler = ThreadTrackingHandler(collector)
7376
logging.root.setLevel(logging.NOTSET)
74-
logging.root.addHandler(logging_handler) # register with logging
75-
76-
# We don't use enable/disable_instrumentation because we can't make these
77-
# functions thread-safe and (hopefully) logging isn't too expensive.
78-
79-
try:
80-
import logbook
81-
logbook_supported = True
82-
except ImportError:
83-
# logbook support is optional, so fail silently
84-
logbook_supported = False
85-
86-
if logbook_supported:
87-
class LogbookThreadTrackingHandler(logbook.handlers.Handler):
88-
def __init__(self, collector):
89-
logbook.handlers.Handler.__init__(self, bubble=True)
90-
self.collector = collector
91-
92-
def emit(self, record):
93-
record = {
94-
'message': record.message,
95-
'time': record.time,
96-
'level': record.level_name,
97-
'file': record.filename,
98-
'line': record.lineno,
99-
'channel': record.channel,
100-
}
101-
self.collector.add_record(record)
102-
103-
logbook_handler = LogbookThreadTrackingHandler(collector)
104-
logbook_handler.push_application() # register with logbook
77+
logging.root.addHandler(logging_handler)
10578

10679

10780
class LoggingPanel(Panel):

docs/panels.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Logging
8282

8383
Path: ``debug_toolbar.panels.logging.LoggingPanel``
8484

85-
Logging output via Python's built-in :mod:`logging`, or via the `logbook <http://logbook.pocoo.org>`_ module.
85+
Logging output via Python's built-in :mod:`logging` module.
8686

8787
Redirects
8888
~~~~~~~~~

0 commit comments

Comments
 (0)