MCPcopy
hub / github.com/sshuttle/sshuttle / log

Function log

sshuttle/helpers.py:25–44  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

23
24
25def log(s):
26 try:
27 sys.stdout.flush()
28 except (IOError, ValueError): # ValueError ~ I/O operation on closed file
29 pass
30 try:
31 # Put newline at end of string if line doesn't have one.
32 if not s.endswith("\n"):
33 s = s+"\n"
34
35 prefix = logprefix
36 s = s.rstrip("\n")
37 for line in s.split("\n"):
38 sys.stderr.write(prefix + line + "\n")
39 prefix = " "
40 sys.stderr.flush()
41 except (IOError, ValueError): # ValueError ~ I/O operation on closed file
42 # this could happen if stderr gets forcibly disconnected, eg. because
43 # our tty closes. That sucks, but it's no reason to abort the program.
44 pass
45
46
47def debug1(s):

Callers 15

nonfatalFunction · 0.90
got_signalFunction · 0.90
onaccept_tcpFunction · 0.90
_mainFunction · 0.90
mainFunction · 0.90
rewrite_etc_hostsFunction · 0.90
flush_systemd_dns_cacheFunction · 0.90
mainFunction · 0.90
_list_routesFunction · 0.90
list_routesFunction · 0.90
start_hostwatchFunction · 0.90
try_sendMethod · 0.90

Calls 2

flushMethod · 0.80
writeMethod · 0.80

Tested by

no test coverage detected