Skip to content

Commit

Permalink
allow a callable no-arg prefix for the debugger (#235)
Browse files Browse the repository at this point in the history
This could be useful for, for example, printing a timestamp
  • Loading branch information
ke4roh authored and prologic committed Oct 13, 2017
1 parent 1327b29 commit cdd4f1a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion circuits/core/debugger.py
Expand Up @@ -113,7 +113,10 @@ def _on_event(self, event, *args, **kwargs):
s = repr(event)

if self.prefix:
s = "%s: %s" % (self.prefix, s)
if hasattr(self.prefix, '__call__'):
s = "%s: %s" % (self.prefix(), s)
else:
s = "%s: %s" % (self.prefix, s)

if self.trim:
s = "%s ...>" % s[:self.trim]
Expand Down

0 comments on commit cdd4f1a

Please sign in to comment.