diff options
author | Rob Austein <sra@hactrn.net> | 2011-10-07 23:38:53 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2011-10-07 23:38:53 +0000 |
commit | c96d715727f64958568f35802a3f9de8743ae32d (patch) | |
tree | 0a87b72e24bc5946897d8b490dd27a8fbfa29058 /rpkid | |
parent | 1157f4bda88f164d038ba2327a8e9531ba4583b5 (diff) |
Add .self.self_handle to log_repr() constructor, if it's available.
This helps a bit with #54, but is a long way from fully identifying
which <self/> is logging at any given moment.
svn path=/rpkid/rpki/log.py; revision=4027
Diffstat (limited to 'rpkid')
-rw-r--r-- | rpkid/rpki/log.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/rpkid/rpki/log.py b/rpkid/rpki/log.py index 72d185e7..bc20e395 100644 --- a/rpkid/rpki/log.py +++ b/rpkid/rpki/log.py @@ -132,10 +132,14 @@ def traceback(do_it = None): def log_repr(obj, *tokens): """ Constructor for __repr__() strings, handles suppression of Python - IDs as needed. + IDs as needed, includes self_handle when available. """ words = ["%s.%s" % (obj.__class__.__module__, obj.__class__.__name__)] + try: + words.append("{%s}" % obj.self.self_handle) + except: + pass words.extend(str(token) for token in tokens if token is not None and token != "") if show_python_ids: words.append(" at %#x" % id(obj)) |