Commit 5ca9a829 authored by UVA Multi-touch's avatar UVA Multi-touch

Logger identifiers now all have the same length.

parent 9e95bdd7
#import time #import time
_id_len = 0
class Logger(object): class Logger(object):
def __init__(self, **kwargs): def __init__(self, **kwargs):
global _id_len
self.identifier = kwargs.get('identifier', self.identifier = kwargs.get('identifier',
self.__class__.__name__) self.__class__.__name__)
self.verbose = kwargs.get('verbose', 0) self.verbose = kwargs.get('verbose', 0)
_id_len = max(_id_len, len(self.identifier))
def log(self, msg, verbosity=1): def log(self, msg, verbosity=1):
# TODO: log time # TODO: log time
if self.verbose >= verbosity: if self.verbose >= verbosity:
print '| %s | %s' % (self.identifier, msg) print '| %s | %s' % ('%%-%ds' % _id_len % self.identifier, msg)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment