def _print(str, *args, **kwargs):
if NO_LOG:
return
str = Formatter().vformat(str, args, kwargs)
str = str.replace('\n', '\n' + ' ' * 11)
stack = inspect.stack()
# Stack depth has to be atleast 3 normally, since _print() should
# be normally only be called from info{_v}(), warn() or error().
# But we still take care of edge cases where this may not be true.
frame = stack[2][0] if len(stack) >= 3 else None
class_ = frame.f_locals['self'].__class__.__name__ if frame and 'self' in frame.f_locals else '<unknown>'
thread = threading.current_thread().name
print(BEHEM0TH_COLOR + '[behem0th]',
CLASS_COLOR + '[' + class_ + ']',
THREAD_COLOR + thread + ':', str, CLEAR_FORMAT)
评论列表
文章目录