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
This commit is contained in:
@@ -57,6 +57,10 @@ def _log_transaction(log, level=cclogging.logging.DEBUG):
|
|||||||
log level.
|
log level.
|
||||||
"""
|
"""
|
||||||
logline = '{0} {1}'.format(args, kwargs)
|
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}...<truncated>'.format(logline[:200])
|
||||||
|
|
||||||
try:
|
try:
|
||||||
log.debug(logline.decode('utf-8', 'replace'))
|
log.debug(logline.decode('utf-8', 'replace'))
|
||||||
|
|||||||
Reference in New Issue
Block a user