summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2020-05-06 22:36:06 +0700
committerGitHub <noreply@github.com>2020-05-06 22:36:06 +0700
commit142a6b99f0da5cf474f03572e1e6c2f8772c77c9 (patch)
treee149dd7d504e89976a6e0fa28c5471d015a610f4 /python/vyos
parent57f905a700291c522f3e6d34bf321cbf258b1caf (diff)
parentfaec542493eedf989f0703a1b4cedb74025bd9e2 (diff)
downloadvyos-1x-142a6b99f0da5cf474f03572e1e6c2f8772c77c9.tar.gz
vyos-1x-142a6b99f0da5cf474f03572e1e6c2f8772c77c9.zip
Merge pull request #394 from thomas-mangin/T2426
debug: T2426: remove invisible characters when printing
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/debug.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/vyos/debug.py b/python/vyos/debug.py
index 1a042cbb4..91431a7bb 100644
--- a/python/vyos/debug.py
+++ b/python/vyos/debug.py
@@ -81,10 +81,17 @@ def enabled(flag):
return _fromenv(flag) or _fromfile(flag)
+def _remove_invisible(string):
+ for char in ('\0', '\a', '\b', '\f', '\v'):
+ string = string.replace(char, '')
+ return string
+
+
def _format(flag, message):
"""
format a log message
"""
+ message = _remove_invisible(message)
return f'DEBUG/{flag.upper():<7} {message}\n'