From 7d5c92c9d8bdac9a376095cd33de46f9d3b981ca Mon Sep 17 00:00:00 2001 From: Kim Oliver Drechsel Date: Sun, 8 Aug 2021 17:18:20 +0200 Subject: [PATCH] =?UTF-8?q?=E2=80=9EUsage=E2=80=9C=20hinzuf=C3=BCgen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Usage.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Usage.md diff --git a/Usage.md b/Usage.md new file mode 100644 index 0000000..a801820 --- /dev/null +++ b/Usage.md @@ -0,0 +1,32 @@ +# Usage + +Simple logger function with colored LogLevel designed to run inside Docker container + +Debug can be enabled by setting the environment variable + +> **DEBUG_MODE** = *True* + +```python +# Usage with os only necessary if environment variable has not been set before (e.g. outside Docker) +import os +os.environ['DEBUG_MODE'] = 'True' # A unset DEBUG_MODE Varibale or with value 'False' will prevent printing Debug Log + +from loghandler import logger + +def main(): + logger.debug("This is a Debug Message") + logger.info("This is a Info Message") + logger.warning("This is a Warning Message") + logger.error("This is a Error Message") + logger.critical("This is a Critical Message") + +main() +``` + +``` +[Fri, 06 Aug 2021 13:36:09] DEBUG [test.py.main:7] This is a Debug Message +[Fri, 06 Aug 2021 13:36:09] INFO [test.py.main:8] This is a Info Message +[Fri, 06 Aug 2021 13:36:09] WARNING [test.py.main:9] This is a Warning Message +[Fri, 06 Aug 2021 13:36:09] ERROR [test.py.main:10] This is a Error Message +[Fri, 06 Aug 2021 13:36:09] CRITICAL [test.py.main:11] This is a Critical Message +``` \ No newline at end of file