summaryrefslogtreecommitdiffstats
path: root/sshuttle/cmdline.py
diff options
context:
space:
mode:
authorScott Kuhl <kuhl@mtu.edu>2020-12-29 12:58:44 -0500
committerBrian May <brian@linuxpenguins.xyz>2021-01-01 19:32:48 +1100
commit7fc33c00201b483f75d3ca9817001fc095f23d2f (patch)
tree333f7ff3541a5757a3ee426bff23d1a78927187f /sshuttle/cmdline.py
parent563f41478a2f5381ca6fa5da57d8dd9927182404 (diff)
Refactor debug, log and Fatal messages.
This commit rewrites the log() function so that it will append a newline at the end of the message if none is present. It doesn't make sense to print a log message without a newline since the next log message (which will write a prefix) expects to be starting at the beginning of a line. Although it isn't strictly necessary, this commit also removes any newlines at the ends of messages. If I missed any, including the newline at the end of the message will continue to work as it did before. Previously, some calls were missing the newline at the end even though including it was necessary for subsequent messages to appear correctly. This code also cleans up some redundant prefixes. The log() method will prepend the prefix and the different processes should set their prefix as soon as they start. Multiline messages are still supported (although the prefix for the additional lines was changed to match the length of the prefix used for the first line).
Diffstat (limited to 'sshuttle/cmdline.py')
-rw-r--r--sshuttle/cmdline.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/sshuttle/cmdline.py b/sshuttle/cmdline.py
index 0e7beeb..70685c1 100644
--- a/sshuttle/cmdline.py
+++ b/sshuttle/cmdline.py
@@ -117,9 +117,9 @@ def main():
return return_code
except Fatal as e:
- log('fatal: %s\n' % e)
+ log('fatal: %s' % e)
return 99
except KeyboardInterrupt:
log('\n')
- log('Keyboard interrupt: exiting.\n')
+ log('Keyboard interrupt: exiting.')
return 1