qubership-pipelines-common-library 2.0.1__py3-none-any.whl → 2.0.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- qubership_pipelines_common_library/v1/utils/utils_cli.py +37 -26
- qubership_pipelines_common_library/v1/utils/utils_logging.py +0 -1
- {qubership_pipelines_common_library-2.0.1.dist-info → qubership_pipelines_common_library-2.0.2.dist-info}/METADATA +1 -1
- {qubership_pipelines_common_library-2.0.1.dist-info → qubership_pipelines_common_library-2.0.2.dist-info}/RECORD +6 -6
- {qubership_pipelines_common_library-2.0.1.dist-info → qubership_pipelines_common_library-2.0.2.dist-info}/WHEEL +0 -0
- {qubership_pipelines_common_library-2.0.1.dist-info → qubership_pipelines_common_library-2.0.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
import os
|
|
2
3
|
import re
|
|
3
|
-
|
|
4
|
+
import sys
|
|
4
5
|
import click
|
|
5
|
-
from rich import box
|
|
6
|
-
from rich.logging import RichHandler
|
|
7
|
-
from rich.panel import Panel
|
|
8
6
|
|
|
9
7
|
from qubership_pipelines_common_library.v1.execution.exec_logger import ExecutionLogger
|
|
10
|
-
from qubership_pipelines_common_library.v1.utils.
|
|
11
|
-
LevelColorFilter
|
|
8
|
+
from qubership_pipelines_common_library.v1.utils.utils_string import UtilsString
|
|
12
9
|
|
|
13
10
|
DEFAULT_CONTEXT_FILE_PATH = 'context.yaml'
|
|
14
11
|
|
|
@@ -37,26 +34,34 @@ def utils_cli(func):
|
|
|
37
34
|
|
|
38
35
|
def _configure_global_logger(global_logger: logging.Logger, log_level: str):
|
|
39
36
|
"""Configure the global logger with a specific log level and formatter."""
|
|
37
|
+
log_level_value = getattr(logging, log_level.upper(), logging.INFO)
|
|
40
38
|
global_logger.setLevel(logging.DEBUG)
|
|
41
39
|
if global_logger.hasHandlers():
|
|
42
40
|
global_logger.handlers.clear()
|
|
43
41
|
global_logger.propagate = True
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
if UtilsString.convert_to_bool(os.getenv('NO_RICH', False)):
|
|
43
|
+
stdout_handler = logging.StreamHandler(sys.stdout)
|
|
44
|
+
stdout_handler.setLevel(log_level_value)
|
|
45
|
+
stdout_handler.setFormatter(logging.Formatter(ExecutionLogger.DEFAULT_FORMAT))
|
|
46
|
+
global_logger.addHandler(stdout_handler)
|
|
47
|
+
else:
|
|
48
|
+
from rich.logging import RichHandler
|
|
49
|
+
from qubership_pipelines_common_library.v1.utils.utils_logging import rich_console, ExtendedReprHighlighter, LevelColorFilter
|
|
50
|
+
rich_handler = RichHandler(
|
|
51
|
+
console=rich_console,
|
|
52
|
+
show_time=False,
|
|
53
|
+
show_level=False,
|
|
54
|
+
show_path=False,
|
|
55
|
+
enable_link_path=False,
|
|
56
|
+
rich_tracebacks=True,
|
|
57
|
+
tracebacks_show_locals=False,
|
|
58
|
+
markup=True,
|
|
59
|
+
highlighter=ExtendedReprHighlighter(),
|
|
60
|
+
)
|
|
61
|
+
rich_handler.addFilter(LevelColorFilter())
|
|
62
|
+
rich_handler.setFormatter(logging.Formatter(ExecutionLogger.LEVELNAME_COLORED_FORMAT))
|
|
63
|
+
rich_handler.setLevel(log_level_value)
|
|
64
|
+
global_logger.addHandler(rich_handler)
|
|
60
65
|
|
|
61
66
|
|
|
62
67
|
def _print_command_name():
|
|
@@ -67,10 +72,16 @@ def _print_command_name():
|
|
|
67
72
|
logging.getLogger().warning("Can't find command name.")
|
|
68
73
|
command_name = ""
|
|
69
74
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
if UtilsString.convert_to_bool(os.getenv('NO_RICH', False)):
|
|
76
|
+
logging.info(f"command_name = {command_name}")
|
|
77
|
+
else:
|
|
78
|
+
from rich import box
|
|
79
|
+
from rich.panel import Panel
|
|
80
|
+
from qubership_pipelines_common_library.v1.utils.utils_logging import rich_console
|
|
81
|
+
command_panel = Panel(f"command_name = {command_name}", expand=False, padding=(0, 1), box=box.ROUNDED)
|
|
82
|
+
rich_console.print()
|
|
83
|
+
rich_console.print(command_panel)
|
|
84
|
+
rich_console.print()
|
|
74
85
|
|
|
75
86
|
|
|
76
87
|
def _transform_kwargs(kwargs):
|
|
@@ -19,12 +19,12 @@ qubership_pipelines_common_library/v1/utils/__init__.py,sha256=QczIlSYNOtXMuMWSz
|
|
|
19
19
|
qubership_pipelines_common_library/v1/utils/rest.py,sha256=OfYGPE2tM-vDUg__ytZKfpCeGVCDePSjXDHK61A2KDM,3069
|
|
20
20
|
qubership_pipelines_common_library/v1/utils/utils.py,sha256=aMyUrJqlnRcFSjNtiyKa5TDJ31m2ABpljeQdnil3A20,1866
|
|
21
21
|
qubership_pipelines_common_library/v1/utils/utils_aws.py,sha256=BPPnHBzPPXPqFijtAiw16sTPu1tFZjS95GkSMX_HdjA,808
|
|
22
|
-
qubership_pipelines_common_library/v1/utils/utils_cli.py,sha256=
|
|
22
|
+
qubership_pipelines_common_library/v1/utils/utils_cli.py,sha256=jkhBswmYqJHfszaYhWknCTxaBx0tEh42McFx5dP6EXQ,4931
|
|
23
23
|
qubership_pipelines_common_library/v1/utils/utils_context.py,sha256=IlMFXGxS8zJw33Gu3SbOUcj88wquIkobBlWkdFbR7MA,3767
|
|
24
24
|
qubership_pipelines_common_library/v1/utils/utils_dictionary.py,sha256=xe8ftnigzyCKWCZaUnI2Xu2ykYlOl1Nc9ATimXuCbgM,1366
|
|
25
25
|
qubership_pipelines_common_library/v1/utils/utils_file.py,sha256=E4RhpeCRhUt-EQ_6pUz-QEKkH8JidJWwYxZmrAvpHBk,2905
|
|
26
26
|
qubership_pipelines_common_library/v1/utils/utils_json.py,sha256=QczIlSYNOtXMuMWSznhV_BkXMM5KLn1wOogtlT2kcy0,598
|
|
27
|
-
qubership_pipelines_common_library/v1/utils/utils_logging.py,sha256=
|
|
27
|
+
qubership_pipelines_common_library/v1/utils/utils_logging.py,sha256=rVkx1OnyL9WmvLvvYij9Fn9tM16geqsCzeeVwObPhRw,1505
|
|
28
28
|
qubership_pipelines_common_library/v1/utils/utils_string.py,sha256=Phx5ZXPRjhjg9AaSPx6WLX9zQvwJH1txslfnG3jJ43w,993
|
|
29
29
|
qubership_pipelines_common_library/v1/webex_client.py,sha256=JU_0NgLu_p6zgaUi-ixgZeFMlJaTAvXwrU1oA607Bv0,2997
|
|
30
30
|
qubership_pipelines_common_library/v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -70,7 +70,7 @@ qubership_pipelines_common_library/v2/sops/sops_client.py,sha256=vB1czEqIQ6aRywk
|
|
|
70
70
|
qubership_pipelines_common_library/v2/utils/crypto_utils.py,sha256=zZ32IJY7WKzJEJNyZQVCPdWC4uujo6goR0MyzBAhn78,1504
|
|
71
71
|
qubership_pipelines_common_library/v2/utils/extension_utils.py,sha256=-OyT6xrIg-PdHHy2Y712rbOAB6Q7WXTqGwP7oVne4k4,965
|
|
72
72
|
qubership_pipelines_common_library/v2/utils/retry_decorator.py,sha256=ItYYL7zam4LrpQrsihis_n6aFCAa32ZAOKKSmxkaENM,4391
|
|
73
|
-
qubership_pipelines_common_library-2.0.
|
|
74
|
-
qubership_pipelines_common_library-2.0.
|
|
75
|
-
qubership_pipelines_common_library-2.0.
|
|
76
|
-
qubership_pipelines_common_library-2.0.
|
|
73
|
+
qubership_pipelines_common_library-2.0.2.dist-info/METADATA,sha256=fKw473tE6YP1Fa4tFCGUpz2uL5754W6rXz0FepFx-KA,3063
|
|
74
|
+
qubership_pipelines_common_library-2.0.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
75
|
+
qubership_pipelines_common_library-2.0.2.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
76
|
+
qubership_pipelines_common_library-2.0.2.dist-info/RECORD,,
|
|
File without changes
|