log.get_caller_pos(): Implement frames > 1

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2019-12-30 17:46:20 +01:00
commit 08f9aae61a

View file

@ -75,9 +75,8 @@ _prio_colors = {
} }
def get_caller_pos(up = 1): def get_caller_pos(up = 1):
assert(up == 1) # TODO: implement this caller = inspect.stack()[up+1]
caller_frame = inspect.currentframe().f_back.f_back return (basename(caller.filename), caller.lineno)
return (basename(caller_frame.f_code.co_filename), caller_frame.f_lineno)
def slog_m(prio, *args, **kwargs): # export def slog_m(prio, *args, **kwargs): # export
if prio > _level: if prio > _level: