diff options
author | Devaev Maxim <[email protected]> | 2018-09-26 02:57:24 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-09-26 02:57:24 +0300 |
commit | 81a5311349564a1016c4af2bf18ae872b650e85b (patch) | |
tree | d01fd027948494e22ae2c14334b98c1515e5e8a4 /kvmd/logging.py | |
parent | f3946f102fc167efdc53c73412b2c0d6ac6c72c5 (diff) |
moved kvmd to the root
Diffstat (limited to 'kvmd/logging.py')
-rw-r--r-- | kvmd/logging.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/kvmd/logging.py b/kvmd/logging.py new file mode 100644 index 00000000..838e13d1 --- /dev/null +++ b/kvmd/logging.py @@ -0,0 +1,15 @@ +import sys +import logging + + +# ===== +def get_logger(depth: int=1) -> logging.Logger: + frame = sys._getframe(1) # pylint: disable=protected-access + frames = [] + while frame: + frames.append(frame) + frame = frame.f_back + if len(frames) - 1 >= depth: + break + name = frames[depth].f_globals["__name__"] + return logging.getLogger(name) |