def process(self, msg, kwargs):
import gevent
thread = gevent.getcurrent()
# use explicit component if it was provided
comp = kwargs.pop('component', None)
if comp is not None:
show_thread = comp != thread
else:
comp = thread
show_thread = False
args = kwargs.pop('args', None)
if args:
msg = msg.format(*self._format_args(args))
message, n = self._format(kwargs.pop('port', comp))
# FIXME: get maximum port name length:
pad = max(15 - n, 0)
# can't use .format to left justify because of the color codes
message += ' ' * pad
section = kwargs.pop('section', None)
if section:
message += ' {} :'.format(section)
message += ' {}'.format(msg)
if show_thread:
message += colored(" (on thread {})".format(thread), 'yellow')
return message, kwargs
评论列表
文章目录