mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-python
synced 2026-01-15 01:52:56 +01:00
log: Add throw()
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
2462ad8c60
commit
d5e268a03b
1 changed files with 7 additions and 0 deletions
|
|
@ -175,6 +175,13 @@ def slog(prio: int, *args, only_printable: bool=False, **kwargs) -> None: # expo
|
|||
for file in files:
|
||||
print(msg, file=file)
|
||||
|
||||
def throw(*args, prio=ERR, caller=None, **kwargs) -> None:
|
||||
if caller is None:
|
||||
caller = get_caller_pos(1)
|
||||
msg = ' '.join([str(arg) for arg in args])
|
||||
slog(prio, msg, caller=caller)
|
||||
raise Exception(msg)
|
||||
|
||||
def parse_log_prio_str(prio: str) -> int: # export
|
||||
try:
|
||||
r = int(prio)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue