diff --git a/alienpy/setup_logging.py b/alienpy/setup_logging.py index 12d2ee7..8576fe6 100644 --- a/alienpy/setup_logging.py +++ b/alienpy/setup_logging.py @@ -1,15 +1,18 @@ -'''alienpy:: Setup logging''' +"""alienpy:: Setup logging""" import os import sys import logging -from .global_vars import * # nosec PYL-W0614 +from .global_vars import ALIENPY_FANCY_PRINT, TMPDIR, USER_HOME, rich_print ############################################# ### ENABLE LOGGING BEFORE ANYTHIN ELSE ############################################# -def print_out(msg: str, toLog: bool = False): + + +def print_out(msg: str, toLog: bool = False) -> None: + """wrapper for print/log to stdout""" if toLog: logging.log(90, msg) else: @@ -19,7 +22,8 @@ def print_out(msg: str, toLog: bool = False): print(msg, flush = True) -def print_err(msg: str, toLog: bool = False): +def print_err(msg: str, toLog: bool = False) -> None: + """wrapper for print/log to stderr""" if toLog: logging.log(95, msg) else: @@ -29,9 +33,8 @@ def print_err(msg: str, toLog: bool = False): print(msg, file = sys.stderr, flush = True) -def setup_logging(debug: bool = False, debug_file:str = f'{USER_HOME}/alien_py.log'): +def setup_logging(debug: bool = False, debug_file:str = f'{USER_HOME}/alien_py.log') -> None: """Setup logging machinery""" - logging.addLevelName(90, 'STDOUT') logging.addLevelName(95, 'STDERR') @@ -62,4 +65,3 @@ def setup_logging(debug: bool = False, debug_file:str = f'{USER_HOME}/alien_py.l if __name__ == '__main__': print('This file should not be executed!', file = sys.stderr, flush = True) sys.exit(95) - diff --git a/alienpy/wb_api.py b/alienpy/wb_api.py index 0eb93e3..ae5377e 100644 --- a/alienpy/wb_api.py +++ b/alienpy/wb_api.py @@ -20,7 +20,7 @@ from .async_tools import syncify from .wb_async import wb_create, wb_close, wb_sendmsg, wb_sendmsg_multi, IsWbConnected -from .tools_nowb import deltat_ms_perf, deltat_us_perf, is_help, writePidFile, read_conf_file, is_my_pid, isReachable, path_readable, CreateJsonCommand, GetMeta, GetResults, PrintDict +from .tools_nowb import deltat_ms_perf, deltat_us_perf, is_help, writePidFile, read_conf_file, is_my_pid, isReachable, path_readable, CreateJsonCommand, PrintDict from .tools_stackcmd import push2stack # , deque_pop_pos from .connect_ssl import get_certs_names diff --git a/alienpy/xrd_tools.py b/alienpy/xrd_tools.py index 2a1a6d4..79b7650 100644 --- a/alienpy/xrd_tools.py +++ b/alienpy/xrd_tools.py @@ -4,6 +4,7 @@ import subprocess import shlex from typing import Union +import logging from .global_vars import * # nosec PYL-W0614 from .setup_logging import print_err