aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/python/websocket-client/py3/websocket/_logging.py
diff options
context:
space:
mode:
authorAlexSm <alex@ydb.tech>2023-12-21 15:05:38 +0100
committerGitHub <noreply@github.com>2023-12-21 15:05:38 +0100
commite98bcbc74422492351c51646dba3849a138a8ffc (patch)
tree38ad7a09b1f9c201ce8a7e3d69f2017388769224 /contrib/python/websocket-client/py3/websocket/_logging.py
parent559d7083cd8378cb25b9e966dedcca21d413e338 (diff)
downloadydb-e98bcbc74422492351c51646dba3849a138a8ffc.tar.gz
Import libs 1 (#590)
* Import libs 1 * Add new file without extension * Add file missed in export config
Diffstat (limited to 'contrib/python/websocket-client/py3/websocket/_logging.py')
-rw-r--r--contrib/python/websocket-client/py3/websocket/_logging.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/contrib/python/websocket-client/py3/websocket/_logging.py b/contrib/python/websocket-client/py3/websocket/_logging.py
index 806de4d41f..b88cda3744 100644
--- a/contrib/python/websocket-client/py3/websocket/_logging.py
+++ b/contrib/python/websocket-client/py3/websocket/_logging.py
@@ -19,25 +19,38 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
-_logger = logging.getLogger('websocket')
+_logger = logging.getLogger("websocket")
try:
from logging import NullHandler
except ImportError:
+
class NullHandler(logging.Handler):
def emit(self, record) -> None:
pass
+
_logger.addHandler(NullHandler())
_traceEnabled = False
-__all__ = ["enableTrace", "dump", "error", "warning", "debug", "trace",
- "isEnabledForError", "isEnabledForDebug", "isEnabledForTrace"]
-
-
-def enableTrace(traceable: bool,
- handler: logging.StreamHandler = logging.StreamHandler(),
- level: str = "DEBUG") -> None:
+__all__ = [
+ "enableTrace",
+ "dump",
+ "error",
+ "warning",
+ "debug",
+ "trace",
+ "isEnabledForError",
+ "isEnabledForDebug",
+ "isEnabledForTrace",
+]
+
+
+def enableTrace(
+ traceable: bool,
+ handler: logging.StreamHandler = logging.StreamHandler(),
+ level: str = "DEBUG",
+) -> None:
"""
Turn on/off the traceability.
@@ -55,7 +68,7 @@ def enableTrace(traceable: bool,
def dump(title: str, message: str) -> None:
if _traceEnabled:
- _logger.debug("--- " + title + " ---")
+ _logger.debug(f"--- {title} ---")
_logger.debug(message)
_logger.debug("-----------------------")