Skip to content

Commit

Permalink
adding the DevDebugSink
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoud committed Feb 7, 2016
1 parent dfd3bee commit 8d7ebcb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lithoxyl/sinks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-

import pdb
import sys
import json
import time
Expand Down Expand Up @@ -379,6 +380,21 @@ def __repr__(self):
return ret


class DevDebugSink(object):
# TODO: configurable max number of traceback signatures, after
# which exit/ignore?

def __init__(self, reraise=False, post_mortem=False):
self.reraise = reraise
self.post_mortem = post_mortem

def on_exception(self, record, exc_type, exc_obj, exc_tb):
if self.post_mortem:
pdb.post_mortem()
if self.reraise:
raise exc_type, exc_obj, exc_tb


if __name__ == '__main__':
fmtr = Formatter('{begin_timestamp} - {record_status}')
emtr = StreamEmitter('stderr')
Expand Down

0 comments on commit 8d7ebcb

Please sign in to comment.