Logs lines with prefix, if is lower or equal to .
(text, level, caller)
| 3096 | _log(text, 2, caller+1) |
| 3097 | |
| 3098 | def _log(text, level, caller): |
| 3099 | ''' |
| 3100 | Logs lines with prefix, if <level> is lower or equal to <g_verbose>. |
| 3101 | ''' |
| 3102 | if level <= g_verbose: |
| 3103 | fr = inspect.stack(context=0)[caller] |
| 3104 | filename = relpath(fr.filename) |
| 3105 | for line in text.split('\n'): |
| 3106 | if g_log_line_numbers: |
| 3107 | print(f'{filename}:{fr.lineno}:{fr.function}(): {line}', file=sys.stdout, flush=1) |
| 3108 | else: |
| 3109 | print(f'{filename}:{fr.function}(): {line}', file=sys.stdout, flush=1) |
| 3110 | |
| 3111 | |
| 3112 | def relpath(path, start=None, allow_up=True): |