mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 01:52:56 +01:00
log.get_caller_pos(): Fix None module
<W> jw-client-devops-web.py [ 29] Exiting jw-client-devops-web.py Exception ignored in: <function App.__del__ at 0x7f3ddeb8f560> Traceback (most recent call last): File "/home/jan/local/src/jw.dev/proj/jw-client-devops-web/src/python/jw/devops/client/web/cmds/App.py", line 43, in __del__ File "/home/jan/local/src/jw.dev/proj/jw-python/tools/python/jwutils/log.py", line 167, in slog File "/home/jan/local/src/jw.dev/proj/jw-python/tools/python/jwutils/log.py", line 126, in get_caller_pos AttributeError: 'NoneType' object has no attribute '__name__' Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
958c077da3
commit
0a1a6e5e17
1 changed files with 3 additions and 2 deletions
|
|
@ -123,8 +123,9 @@ def get_caller_pos(up: int = 1, kwargs: Optional[dict[str, Any]] = None) -> Tupl
|
||||||
del kwargs['caller']
|
del kwargs['caller']
|
||||||
return r
|
return r
|
||||||
caller = inspect.stack()[up+1]
|
caller = inspect.stack()[up+1]
|
||||||
mod = inspect.getmodule(caller[0]).__name__
|
mod = inspect.getmodule(caller[0])
|
||||||
return (mod, basename(caller.filename), caller.lineno)
|
mod_name = '' if mod is None else mod.__name__
|
||||||
|
return (mod_name, basename(caller.filename), caller.lineno)
|
||||||
|
|
||||||
def slog_m(prio: int, *args, **kwargs) -> None: # export
|
def slog_m(prio: int, *args, **kwargs) -> None: # export
|
||||||
if prio > _level:
|
if prio > _level:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue