python-sdk-remote 0.0.149__tar.gz → 0.0.151__tar.gz
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.
Potentially problematic release.
This version of python-sdk-remote might be problematic. Click here for more details.
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/PKG-INFO +1 -1
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/README.md +6 -2
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/constants.py +3 -0
- python_sdk_remote-0.0.151/python_sdk_remote/src/constants_src_mini_logger.py +18 -0
- python_sdk_remote-0.0.151/python_sdk_remote/src/mini_logger.py +149 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/utilities.py +32 -14
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote.egg-info/PKG-INFO +1 -1
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote.egg-info/SOURCES.txt +1 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/setup.py +2 -2
- python_sdk_remote-0.0.149/python_sdk_remote/src/mini_logger.py +0 -140
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/pyproject.toml +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/__init__.py +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/http_response.py +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/is_test_data.py +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/item.py +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/our_object.py +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/unified_json.py +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/valid_json_versions.py +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/validate_environment.py +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote.egg-info/dependency_links.txt +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote.egg-info/requires.txt +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote.egg-info/top_level.txt +0 -0
- {python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/setup.cfg +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# TODO: rewrite with more
|
|
1
|
+
# TODO: rewrite with more examples
|
|
2
2
|
|
|
3
3
|
In serverless, use this decorator:
|
|
4
4
|
```py
|
|
@@ -8,4 +8,8 @@ logger = Logger.create_logger(object=your_logger_object)
|
|
|
8
8
|
@handler_decorator(logger=logger)
|
|
9
9
|
def my_handler(request_parameters: dict) -> dict:
|
|
10
10
|
# here you can use both camelCase and snake_case keys from request_parameters
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Versions
|
|
14
|
+
|
|
15
|
+
0.0.151 for PRINT_STARS
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
from logger_local.LoggerComponentEnum import LoggerComponentEnum
|
|
2
2
|
|
|
3
|
+
# TODO Add SmartDatastoreAttributes Class which includes seller_sales_organization_id, seller_delivery_organization_id, buyer_organization_id, distribution_organization_id, end_customer_organization_id, organization_project_id, seller_case_id, customer_case_id, location_id, knowledge_base, segment_id, vertical_id, industry_id, practice_id, segment_id, vertical_id, business_unit_id, driver_id, distribution_line_id, (Add it to python-sdk-remote as both Storage, SmartDataStore should use it) # noqa E501
|
|
4
|
+
|
|
3
5
|
PYTHON_SDK_REMOTE_COMPONENT_ID = 184
|
|
4
6
|
PYTHON_SDK_REMOTE_COMPONENT_NAME = 'python_sdk_remote'
|
|
5
7
|
|
|
@@ -10,6 +12,7 @@ OBJECT_TO_INSERT_CODE = {
|
|
|
10
12
|
'developer_email_address': 'sahar.g@circ.zone'
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
# Move this to the constants_test_python_sdk_remote file (based on the python-package-template)
|
|
13
16
|
OBJECT_TO_INSERT_TEST = {
|
|
14
17
|
'component_id': PYTHON_SDK_REMOTE_COMPONENT_ID,
|
|
15
18
|
'component_name': PYTHON_SDK_REMOTE_COMPONENT_NAME,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
# TODO I think enum values should be in uppercase
|
|
5
|
+
class LogMessageSeverity(Enum):
|
|
6
|
+
Debug = 100
|
|
7
|
+
Verbose = 200
|
|
8
|
+
Init = 300
|
|
9
|
+
Info = 500
|
|
10
|
+
Warning = 600
|
|
11
|
+
Error = 700
|
|
12
|
+
Critical = 800
|
|
13
|
+
Exception = 900
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class StartEndEnum(Enum):
|
|
17
|
+
Start = 400
|
|
18
|
+
End = 402
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import os
|
|
3
|
+
import sys
|
|
4
|
+
# from enum import Enum
|
|
5
|
+
import inspect
|
|
6
|
+
from .constants_src_mini_logger import LogMessageSeverity, StartEndEnum
|
|
7
|
+
|
|
8
|
+
# TODO LOGGER_MINIMAL_SEVERITY_DEFAULT
|
|
9
|
+
LOGGER_MINIMUM_SEVERITY = os.getenv("LOGGER_MINIMUM_SEVERITY", "INFO").upper()
|
|
10
|
+
# logging expects NOTSET/DEBUG/INFO/WARNING/ERROR/FATAL/CRITICAL
|
|
11
|
+
if LOGGER_MINIMUM_SEVERITY.isdigit():
|
|
12
|
+
# TODO logger_minimal_severity_default_value
|
|
13
|
+
logger_minimum_severity = int(LOGGER_MINIMUM_SEVERITY)
|
|
14
|
+
# TODO Change Magic Numbers and use the values from Logger.MessageSeverity
|
|
15
|
+
if logger_minimum_severity < LogMessageSeverity.Start.value:
|
|
16
|
+
# TODO LOGGER_MINIMAL_SEVERITY_DEFAULT_NAME =
|
|
17
|
+
# TODO Change "DEBUG", "INFO", "WARNING" ... into enum values from Logger.LogMessageSeverity
|
|
18
|
+
LOGGER_MINIMUM_SEVERITY = LogMessageSeverity.Debug
|
|
19
|
+
elif logger_minimum_severity < LogMessageSeverity.WARNING.value:
|
|
20
|
+
LOGGER_MINIMUM_SEVERITY = LogMessageSeverity.Info
|
|
21
|
+
elif logger_minimum_severity < LogMessageSeverity.Error.value:
|
|
22
|
+
LOGGER_MINIMUM_SEVERITY = LogMessageSeverity.WARNING
|
|
23
|
+
elif logger_minimum_severity < LogMessageSeverity.Critical.value:
|
|
24
|
+
LOGGER_MINIMUM_SEVERITY = LogMessageSeverity.Error
|
|
25
|
+
else:
|
|
26
|
+
LOGGER_MINIMUM_SEVERITY = LogMessageSeverity.Critical
|
|
27
|
+
|
|
28
|
+
logging.basicConfig(level=LOGGER_MINIMUM_SEVERITY, stream=sys.stdout,
|
|
29
|
+
format="%(asctime)s - %(message)s")
|
|
30
|
+
logger = logging.getLogger(__name__)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class MiniLogger:
|
|
34
|
+
# TODO Can we so one generic function call by all
|
|
35
|
+
|
|
36
|
+
_is_write_to_sql = False # Should be always False in MiniLogger
|
|
37
|
+
|
|
38
|
+
@staticmethod
|
|
39
|
+
def _log(level: LogMessageSeverity, start_or_end: StartEndEnum = None, log_message: str = None, **kwargs):
|
|
40
|
+
"""
|
|
41
|
+
Private method to unify all log methods
|
|
42
|
+
|
|
43
|
+
Parameters:
|
|
44
|
+
level (MessageSeverity): log level
|
|
45
|
+
log_message (str): The message to be printed.
|
|
46
|
+
"""
|
|
47
|
+
object = kwargs.get("object")
|
|
48
|
+
method_name = level.name.lower()
|
|
49
|
+
method = getattr(logger, method_name)
|
|
50
|
+
if not start_or_end:
|
|
51
|
+
action_name = level.name
|
|
52
|
+
else:
|
|
53
|
+
action_name = start_or_end.name
|
|
54
|
+
stk = inspect.stack()[2]
|
|
55
|
+
function = stk.function
|
|
56
|
+
line = stk.lineno
|
|
57
|
+
if object is None:
|
|
58
|
+
method(f"Function: {function}, Line: {line}; {action_name} - {log_message}")
|
|
59
|
+
else:
|
|
60
|
+
method(f"Function: {function}, Line: {line}; {action_name} - {log_message} - {object}")
|
|
61
|
+
|
|
62
|
+
@staticmethod
|
|
63
|
+
# TODO Add a new file called align_logger_and_minilogger_test.py, which makes sure the signature of all methods of MiniLogger and Logger are the same and we can change from MiniLogger to Logger and vice versa by changing only one line in our code. If we should change the signatures, we should make them backward compatible. # noqa E501
|
|
64
|
+
def start(log_message: str = None, **kwargs):
|
|
65
|
+
"""
|
|
66
|
+
Print a log message with the current time.
|
|
67
|
+
|
|
68
|
+
Parameters:
|
|
69
|
+
log_message (str): The message to be printed.
|
|
70
|
+
"""
|
|
71
|
+
MiniLogger._log(LogMessageSeverity.Debug, StartEndEnum.Start, log_message, **kwargs)
|
|
72
|
+
|
|
73
|
+
@staticmethod
|
|
74
|
+
def end(log_message: str = None, **kwargs):
|
|
75
|
+
"""
|
|
76
|
+
Print a log message with the current time.
|
|
77
|
+
|
|
78
|
+
Parameters:
|
|
79
|
+
log_message (str): The message to be printed.
|
|
80
|
+
"""
|
|
81
|
+
MiniLogger._log(LogMessageSeverity.Debug, StartEndEnum.End, log_message, **kwargs)
|
|
82
|
+
|
|
83
|
+
# TODO convert all those methods (debug, info, warning, error) into one unified private method
|
|
84
|
+
# TODO Add to the unified private method print of the name of method, version
|
|
85
|
+
# and line number of the calling function/method to the mini_logger methods
|
|
86
|
+
@staticmethod
|
|
87
|
+
def debug(log_message: str = None, **kwargs):
|
|
88
|
+
"""
|
|
89
|
+
Print a log message with the current time.
|
|
90
|
+
|
|
91
|
+
Parameters:
|
|
92
|
+
log_message (str): The message to be printed.
|
|
93
|
+
"""
|
|
94
|
+
MiniLogger._log(LogMessageSeverity.Debug, log_message=log_message, **kwargs)
|
|
95
|
+
|
|
96
|
+
@staticmethod
|
|
97
|
+
def info(log_message: str = None, **kwargs):
|
|
98
|
+
"""
|
|
99
|
+
Print a log message with the current time.
|
|
100
|
+
|
|
101
|
+
Parameters:
|
|
102
|
+
log_message (str): The message to be printed.
|
|
103
|
+
"""
|
|
104
|
+
MiniLogger._log(LogMessageSeverity.Info, log_message=log_message, **kwargs)
|
|
105
|
+
|
|
106
|
+
@staticmethod
|
|
107
|
+
def warning(log_message: str = None, **kwargs):
|
|
108
|
+
"""
|
|
109
|
+
Print a log message with the current time.
|
|
110
|
+
|
|
111
|
+
Parameters:
|
|
112
|
+
log_message (str): The message to be printed.
|
|
113
|
+
"""
|
|
114
|
+
# TODO Add the source of the message - We should add the object or atleast some parts of it
|
|
115
|
+
MiniLogger._log(LogMessageSeverity.WARNING, log_message=log_message, **kwargs)
|
|
116
|
+
|
|
117
|
+
@staticmethod
|
|
118
|
+
def error(log_message: str = None, **kwargs):
|
|
119
|
+
"""
|
|
120
|
+
Print a log error message with the current time.
|
|
121
|
+
|
|
122
|
+
Parameters:
|
|
123
|
+
log_message (str): The message to be printed.
|
|
124
|
+
"""
|
|
125
|
+
MiniLogger._log(LogMessageSeverity.Error, log_message=log_message, **kwargs)
|
|
126
|
+
|
|
127
|
+
@staticmethod
|
|
128
|
+
def exception(log_message: str = None, **kwargs):
|
|
129
|
+
"""
|
|
130
|
+
Print a log error message with the current time.
|
|
131
|
+
|
|
132
|
+
Parameters:
|
|
133
|
+
log_message (str): The message to be printed.
|
|
134
|
+
"""
|
|
135
|
+
object = kwargs.get("object")
|
|
136
|
+
if isinstance(object, Exception):
|
|
137
|
+
exception = object
|
|
138
|
+
elif isinstance(object, dict):
|
|
139
|
+
exception = object.get("exception")
|
|
140
|
+
else:
|
|
141
|
+
exception = None
|
|
142
|
+
|
|
143
|
+
if object is None:
|
|
144
|
+
logger.exception(f"EXCEPTION - {log_message}")
|
|
145
|
+
else:
|
|
146
|
+
logger.exception(f"EXCEPTION- {log_message} - {object}", exc_info=exception)
|
|
147
|
+
|
|
148
|
+
def is_write_to_sql(self):
|
|
149
|
+
return self._is_write_to_sql
|
|
@@ -30,6 +30,7 @@ DEFAULT_LANG_CODE_STR = "en"
|
|
|
30
30
|
# TODO If no one is using DEFAULT_DATETIME_FORMAT, let's comment it
|
|
31
31
|
# TODO Let's split DEFAULT_DATETIME_FORMAT into two const 1. Displayable to Humans (MMM) 2. Internal (sortable) with %m
|
|
32
32
|
DEFAULT_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
|
|
33
|
+
PRINT_STARS = "*** "
|
|
33
34
|
|
|
34
35
|
|
|
35
36
|
def append_if_not_exist(lst: list, item: object) -> None:
|
|
@@ -279,6 +280,21 @@ def is_datetime_in_datetime_range(check_datetime: datetime, datetime_range: (dat
|
|
|
279
280
|
return is_datetime_in_datetime_range_result
|
|
280
281
|
|
|
281
282
|
|
|
283
|
+
# TODO add optional_prefix optional parameter. First check with optional_prefix, if not found, check without it.
|
|
284
|
+
def our_get_env(key: str, default: str = None, raise_if_not_found: bool = True,
|
|
285
|
+
raise_if_empty: bool = False) -> str:
|
|
286
|
+
logger.start(object={"key": key, "default": default,
|
|
287
|
+
"raise_if_not_found": raise_if_not_found,
|
|
288
|
+
"raise_if_empty": raise_if_empty})
|
|
289
|
+
env_var = os.getenv(key, default)
|
|
290
|
+
# TODO: "default is None" is always False
|
|
291
|
+
if ((raise_if_not_found and key not in os.environ and default is None)
|
|
292
|
+
or (raise_if_empty and not env_var and not default)):
|
|
293
|
+
raise Exception(f"Environment variable {key} not found - please check your .env file") # noqa: E501
|
|
294
|
+
logger.end(object={"env_var": env_var})
|
|
295
|
+
return env_var
|
|
296
|
+
|
|
297
|
+
|
|
282
298
|
def get_brand_name(raise_if_not_found: bool = True,
|
|
283
299
|
raise_if_empty: bool = False) -> str:
|
|
284
300
|
get_brand_name_result = our_get_env("BRAND_NAME",
|
|
@@ -296,19 +312,21 @@ def get_environment_name(raise_if_not_found: bool = True,
|
|
|
296
312
|
return environment_name
|
|
297
313
|
|
|
298
314
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
315
|
+
def get_product_user_identifier(raise_if_not_found: bool = True,
|
|
316
|
+
raise_if_empty: bool = False) -> str:
|
|
317
|
+
get_product_user_identifier_result = our_get_env("PRODUCT_USER_IDENTIFIER",
|
|
318
|
+
raise_if_not_found=raise_if_not_found, # noqa E501
|
|
319
|
+
raise_if_empty=raise_if_empty) # noqa E501
|
|
320
|
+
return get_product_user_identifier_result
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
def get_product_user_password(raise_if_not_found: bool = True,
|
|
324
|
+
raise_if_empty: bool = False) -> str:
|
|
325
|
+
# TODO Add support to PRODUCT_USER_PASSWORD and deprecation message for PRODUCT_PASSWORD (backward compatible)
|
|
326
|
+
get_product_user_password_result = our_get_env("PRODUCT_PASSWORD",
|
|
327
|
+
raise_if_not_found=raise_if_not_found, # noqa E501
|
|
328
|
+
raise_if_empty=raise_if_empty) # noqa E501
|
|
329
|
+
return get_product_user_password_result
|
|
312
330
|
|
|
313
331
|
|
|
314
332
|
# TODO As only the database package uses those, let's move those three to the database package # noqa: E501
|
|
@@ -418,7 +436,7 @@ def validate_arguments(args: dict) -> None:
|
|
|
418
436
|
:return: True if all arguments are not None or '', False otherwise
|
|
419
437
|
"""
|
|
420
438
|
for arg, value in args.items():
|
|
421
|
-
if not
|
|
439
|
+
if not value:
|
|
422
440
|
raise ValueError(f"Argument {arg} is cannot be empty (got {value})")
|
|
423
441
|
|
|
424
442
|
|
{python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote.egg-info/SOURCES.txt
RENAMED
|
@@ -8,6 +8,7 @@ python_sdk_remote.egg-info/requires.txt
|
|
|
8
8
|
python_sdk_remote.egg-info/top_level.txt
|
|
9
9
|
python_sdk_remote/src/__init__.py
|
|
10
10
|
python_sdk_remote/src/constants.py
|
|
11
|
+
python_sdk_remote/src/constants_src_mini_logger.py
|
|
11
12
|
python_sdk_remote/src/http_response.py
|
|
12
13
|
python_sdk_remote/src/is_test_data.py
|
|
13
14
|
python_sdk_remote/src/item.py
|
|
@@ -3,11 +3,11 @@ import setuptools
|
|
|
3
3
|
PACKAGE_NAME = "python-sdk-remote"
|
|
4
4
|
package_dir = PACKAGE_NAME.replace("-", "_")
|
|
5
5
|
|
|
6
|
-
# used by python -m build
|
|
6
|
+
# used by python -m build.
|
|
7
7
|
# python -m build needs pyproject.toml or setup.py
|
|
8
8
|
setuptools.setup(
|
|
9
9
|
name=PACKAGE_NAME,
|
|
10
|
-
version='0.0.
|
|
10
|
+
version='0.0.151', # https://pypi.org/project/python-sdk-remote/
|
|
11
11
|
author="Circles",
|
|
12
12
|
author_email="info@circlez.ai",
|
|
13
13
|
description="PyPI Package for Circles Python SDK Local Python",
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
import os
|
|
3
|
-
import sys
|
|
4
|
-
|
|
5
|
-
# TODO LOGGER_MINIMAL_SEVERITY_DEFAULT
|
|
6
|
-
LOGGER_MINIMUM_SEVERITY = os.getenv("LOGGER_MINIMUM_SEVERITY", "INFO").upper()
|
|
7
|
-
# logging expects NOTSET/DEBUG/INFO/WARNING/ERROR/FATAL/CRITICAL
|
|
8
|
-
if LOGGER_MINIMUM_SEVERITY.isdigit():
|
|
9
|
-
# TODO logger_minimal_severity_default_value
|
|
10
|
-
logger_minimum_severity = int(LOGGER_MINIMUM_SEVERITY)
|
|
11
|
-
# TODO Change Magic Numbers and use the values from Logger.MessageSeverity
|
|
12
|
-
if logger_minimum_severity < 400:
|
|
13
|
-
# TODO LOGGER_MINIMAL_SEVERITY_DEFAULT_NAME =
|
|
14
|
-
# TODO Change "DEBUG", "INFO", "WARNING" ... into enum values from Logger.MessageSeverity
|
|
15
|
-
LOGGER_MINIMUM_SEVERITY = "DEBUG"
|
|
16
|
-
elif logger_minimum_severity < 600:
|
|
17
|
-
LOGGER_MINIMUM_SEVERITY = "INFO"
|
|
18
|
-
elif logger_minimum_severity < 700:
|
|
19
|
-
LOGGER_MINIMUM_SEVERITY = "WARNING"
|
|
20
|
-
elif logger_minimum_severity < 800:
|
|
21
|
-
LOGGER_MINIMUM_SEVERITY = "ERROR"
|
|
22
|
-
else:
|
|
23
|
-
LOGGER_MINIMUM_SEVERITY = "CRITICAL"
|
|
24
|
-
|
|
25
|
-
logging.basicConfig(level=LOGGER_MINIMUM_SEVERITY, stream=sys.stdout,
|
|
26
|
-
format="%(asctime)s - %(message)s")
|
|
27
|
-
logger = logging.getLogger(__name__)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class MiniLogger:
|
|
31
|
-
# TODO Can we have one generic function called by all as we have a lot of duplicated code here?
|
|
32
|
-
|
|
33
|
-
# TODO: print the caller function name
|
|
34
|
-
|
|
35
|
-
@staticmethod
|
|
36
|
-
def start(message: str = "", object: dict = None):
|
|
37
|
-
"""
|
|
38
|
-
Print a log message with the current time.
|
|
39
|
-
|
|
40
|
-
Parameters:
|
|
41
|
-
message (str): The message to be printed.
|
|
42
|
-
object (dict): The object to be printed.
|
|
43
|
-
"""
|
|
44
|
-
if object is None:
|
|
45
|
-
logger.debug(f"START - {message}")
|
|
46
|
-
else:
|
|
47
|
-
logger.debug(f"START - {message} - {object}")
|
|
48
|
-
|
|
49
|
-
@staticmethod
|
|
50
|
-
def end(message: str = "", object: dict = None):
|
|
51
|
-
"""
|
|
52
|
-
Print a log message with the current time.
|
|
53
|
-
|
|
54
|
-
Parameters:
|
|
55
|
-
message (str): The message to be printed.
|
|
56
|
-
"""
|
|
57
|
-
if object is None:
|
|
58
|
-
logger.debug(f"END - {message}")
|
|
59
|
-
else:
|
|
60
|
-
logger.debug(f"END - {message} - {object}")
|
|
61
|
-
|
|
62
|
-
# TODO convert all those methods (debug, info, warning, error) into one unified private method
|
|
63
|
-
# TODO Add to the unified private method print of the name of method, version and line number of the calling function/method to the mini_logger methods # noqa: E501
|
|
64
|
-
@staticmethod
|
|
65
|
-
def debug(message: str = "", object: dict = None):
|
|
66
|
-
"""
|
|
67
|
-
Print a log message with the current time.
|
|
68
|
-
|
|
69
|
-
Parameters:
|
|
70
|
-
message (str): The message to be printed.
|
|
71
|
-
object (dict): The object to be printed.
|
|
72
|
-
"""
|
|
73
|
-
if object is None:
|
|
74
|
-
logger.debug(f"DEBUG - {message}")
|
|
75
|
-
else:
|
|
76
|
-
logger.debug(f"DEBUG {message} - {object}")
|
|
77
|
-
|
|
78
|
-
@staticmethod
|
|
79
|
-
def info(message: str = "", object: dict = None):
|
|
80
|
-
"""
|
|
81
|
-
Print a log message with the current time.
|
|
82
|
-
|
|
83
|
-
Parameters:
|
|
84
|
-
message (str): The message to be printed.
|
|
85
|
-
object (dict): The object to be printed.
|
|
86
|
-
"""
|
|
87
|
-
if object is None:
|
|
88
|
-
logger.info(f"INFO - {message}")
|
|
89
|
-
else:
|
|
90
|
-
logger.info(f"INFO {message} - {object}")
|
|
91
|
-
|
|
92
|
-
@staticmethod
|
|
93
|
-
def warning(message: str = "", object: dict = None):
|
|
94
|
-
"""
|
|
95
|
-
Print a log message with the current time.
|
|
96
|
-
|
|
97
|
-
Parameters:
|
|
98
|
-
message (str): The message to be printed.
|
|
99
|
-
object (dict): The object to be printed.
|
|
100
|
-
"""
|
|
101
|
-
# TODO Add the source of the message - We should add the object or atleast some parts of it
|
|
102
|
-
if object is None:
|
|
103
|
-
logger.warning(f"WARNING - {message}")
|
|
104
|
-
else:
|
|
105
|
-
logger.warning(f"WARNING {message} - {object}")
|
|
106
|
-
|
|
107
|
-
@staticmethod
|
|
108
|
-
def error(message: str = "", object: dict = None):
|
|
109
|
-
"""
|
|
110
|
-
Print a log error message with the current time.
|
|
111
|
-
|
|
112
|
-
Parameters:
|
|
113
|
-
message (str): The message to be printed.
|
|
114
|
-
object (dict): The object to be printed.
|
|
115
|
-
"""
|
|
116
|
-
if object is None:
|
|
117
|
-
logger.error(f"ERROR - {message}")
|
|
118
|
-
else:
|
|
119
|
-
logger.error(f"ERROR - {message} - {object}")
|
|
120
|
-
|
|
121
|
-
@staticmethod
|
|
122
|
-
def exception(message: str = "", object: Exception or dict = None):
|
|
123
|
-
"""
|
|
124
|
-
Print a log error message with the current time.
|
|
125
|
-
|
|
126
|
-
Parameters:
|
|
127
|
-
message (str): The message to be printed.
|
|
128
|
-
object (dict / Exception): The object / Exception to be printed.
|
|
129
|
-
"""
|
|
130
|
-
if isinstance(object, Exception):
|
|
131
|
-
exception = object
|
|
132
|
-
elif isinstance(object, dict):
|
|
133
|
-
exception = object.get("exception")
|
|
134
|
-
else:
|
|
135
|
-
exception = None
|
|
136
|
-
|
|
137
|
-
if object is None:
|
|
138
|
-
logger.exception(f"EXCEPTION - {message}")
|
|
139
|
-
else:
|
|
140
|
-
logger.exception(f"EXCEPTION- {message} - {object}", exc_info=exception)
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/http_response.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/is_test_data.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/unified_json.py
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote/src/valid_json_versions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote.egg-info/requires.txt
RENAMED
|
File without changes
|
{python_sdk_remote-0.0.149 → python_sdk_remote-0.0.151}/python_sdk_remote.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|