From 1a8e4893b694191a1e35c7fe6ad34c84883d2fb2 Mon Sep 17 00:00:00 2001 From: josh7810 Date: Tue, 4 Apr 2017 17:05:16 -0500 Subject: [PATCH] Truncate the logline in logging wrapper * This will prevent tons of text being thrown in to the logs by SLOs, DLOS, lots of querey params, etc. Change-Id: I04504bf1773552127d7cd596f9ea072f1064efd2 --- cloudcafe/objectstorage/objectstorage_api/client.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cloudcafe/objectstorage/objectstorage_api/client.py b/cloudcafe/objectstorage/objectstorage_api/client.py index 7f3d86f8..10ff1cce 100644 --- a/cloudcafe/objectstorage/objectstorage_api/client.py +++ b/cloudcafe/objectstorage/objectstorage_api/client.py @@ -57,6 +57,10 @@ def _log_transaction(log, level=cclogging.logging.DEBUG): log level. """ logline = '{0} {1}'.format(args, kwargs) + # If the logline is over 200, just show the first 200 characters + # and truncate the rest. + if logline and len(logline) > 200: + logline = '{0}...'.format(logline[:200]) try: log.debug(logline.decode('utf-8', 'replace'))