From 4a0c17a95709f2435bfb0326f39f9f317cff7e32 Mon Sep 17 00:00:00 2001 From: Art <artiom.lukyanchyk@hs-hannover.de> Date: Tue, 12 Sep 2017 17:10:05 +0200 Subject: [PATCH] Update README.md --- README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 89e853a..2d574b8 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,17 @@ # Development Utils -## Colored logger +# Colored logger #### What? Bunch of patches for python logging: - add colors - - change `stderr` stream (default everywhere) to `stdout` + - change `stderr` stream references to `stdout`. Weirdly enough `stderr` is the default logging stream for everything, most configurations (including default Django) don't care to change it. #### Why? -Because you don't want to see everything in red in your IDE +Because you don't want to see everything in red in your IDE. + +#### Safe? +Quite safe. The downloaded file is only executed if its SHA256 matches the expected value. Patched logging also behaves very stable, time tested. #### How? Add the following piece of code: @@ -20,15 +23,10 @@ try: # Colored logger CaaS. Auto downloaded and verified. import os import hashlib from urllib import request - cache, url = "/tmp/_colored_logger.py", "https://lab.it.hs-hannover.de/lukyanch/pydevutils/raw/140726c2cb35dd5f770c4bde86fee3f5d61348b6/colored_logger.py" + cache, url = "/tmp/_colored_logger.py", "https://lab.it.hs-hannover.de/lukyanch/pydevutils/raw/fa4af6555a8eb996e1be158ca12691de9b33ba45/colored_logger.py" code = bool(os.path.exists(cache) or request.urlretrieve(url, cache)) and open(cache, "r").read() assert hashlib.sha256(code.encode()).hexdigest() == "d4d261a40f95733f9fb184fc4ccb55d007b880cb62c8d6a06824d43eeb1391ac", "unrecognized content in" + cache exec(code) except Exception as e: print("No colored logger: {e.__class__.__name__}: {e}".format(e=e)) ``` - -# Safe? -Quite safe. The downloaded file is only executed if its SHA256 matches the expected value. - - -- GitLab