From 06f2917eae5fc24ad7a050a9b4abef1b5944d511 Mon Sep 17 00:00:00 2001 From: Alejandro Saucedo Date: Thu, 28 Jan 2021 08:24:54 +0000 Subject: [PATCH] Updated python docs to update logs --- .gitignore | 1 + docs/overview/python-package.rst | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cd77b0674..fa4fce505 100644 --- a/.gitignore +++ b/.gitignore @@ -185,5 +185,6 @@ release/ # Kompute swiftshader/ +vk_swiftshader_icd.json diff --git a/docs/overview/python-package.rst b/docs/overview/python-package.rst index c9e12daaa..4983b8fe9 100644 --- a/docs/overview/python-package.rst +++ b/docs/overview/python-package.rst @@ -313,5 +313,33 @@ Log Level Configuration Logging inside the C++ uses the PyBind logging, which allows for all the std::cout to be passed to a python logger. -All python output is logged to the logger with the name `kp`. +All python output is logged to the logger with the name `kp`. You can interact with the logger similar to any python logging as per the example below: + +.. code-block:: python + :linenos: + + >>> import kp + >>> import logging + >>> + >>> kp_logger = logging.getLogger("kp") + >>> kp_logger.setLevel(logging.INFO) + >>> + >>> kp.Manager() + INFO:kp:Using physical device index {} found {} + + + >>> kp_logger.setLevel(logging.DEBUG) + >>> + >>> kp.Manager() + DEBUG:kp:Kompute Manager creating instance + DEBUG:kp:Kompute Manager Instance Created + DEBUG:kp:Kompute Manager creating Device + INFO:kp:Using physical device index {} found {} + DEBUG:kp:Kompute Manager device created + DEBUG:kp:Kompute Manager compute queue obtained + DEBUG:kp:Kompute Manager Destructor started + INFO:kp:Destroying device + DEBUG:kp:Kompute Manager Destroyed Device + DEBUG:kp:Kompute Manager Destroyed Instance +