resolves Christmas-tree in logging (replaced with duplex space indentation)

pull/1413/head
sebres 2016-07-13 09:44:32 +02:00
parent ad393fcfbb
commit 53da35ea49
3 changed files with 10 additions and 10 deletions

View File

@ -227,11 +227,11 @@ class Fail2banClient(Fail2banCmdLine, Thread):
# prepare: read config, check configuration is valid, etc.: # prepare: read config, check configuration is valid, etc.:
if phase is not None: if phase is not None:
phase['start'] = True phase['start'] = True
logSys.debug('-- client phase %s', phase) logSys.debug(' client phase %s', phase)
stream = self.__prepareStartServer() stream = self.__prepareStartServer()
if phase is not None: if phase is not None:
phase['ready'] = phase['start'] = (True if stream else False) phase['ready'] = phase['start'] = (True if stream else False)
logSys.debug('-- client phase %s', phase) logSys.debug(' client phase %s', phase)
if not stream: if not stream:
return False return False
# configure server with config stream: # configure server with config stream:
@ -248,7 +248,7 @@ class Fail2banClient(Fail2banCmdLine, Thread):
def __processCommand(self, cmd): def __processCommand(self, cmd):
if len(cmd) == 1 and cmd[0] == "start": if len(cmd) == 1 and cmd[0] == "start":
ret = self.__startServer(self._conf["background"]) ret = self.__startServer(self._conf["background"])
if not ret: if not ret:
return False return False
@ -322,7 +322,7 @@ class Fail2banClient(Fail2banCmdLine, Thread):
# Wait for the server to start (the server has 30 seconds to answer ping) # Wait for the server to start (the server has 30 seconds to answer ping)
starttime = time.time() starttime = time.time()
logSys.debug("__waitOnServer: %r", (alive, maxtime)) logSys.debug("__waitOnServer: %r", (alive, maxtime))
test = lambda: os.path.exists(self._conf["socket"]) and self.__ping() test = lambda: os.path.exists(self._conf["socket"]) and self.__ping()
with VisualWait(self._conf["verbose"]) as vis: with VisualWait(self._conf["verbose"]) as vis:
sltime = 0.0125 / 2 sltime = 0.0125 / 2
while self._alive: while self._alive:
@ -432,7 +432,7 @@ class _VisualWait:
self.pos += self.delta self.pos += self.delta
if self.delta > 0: if self.delta > 0:
s = " #\x1b[1D" if self.pos > 1 else "# \x1b[2D" s = " #\x1b[1D" if self.pos > 1 else "# \x1b[2D"
else: else:
s = "\x1b[1D# \x1b[2D" s = "\x1b[1D# \x1b[2D"
sys.stdout.write(s) sys.stdout.write(s)
sys.stdout.flush() sys.stdout.flush()

View File

@ -112,7 +112,7 @@ class Fail2banCmdLine():
output(" --timeout timeout to wait for the server (for internal usage only, don't read configuration)") output(" --timeout timeout to wait for the server (for internal usage only, don't read configuration)")
output(" -h, --help display this help message") output(" -h, --help display this help message")
output(" -V, --version print the version") output(" -V, --version print the version")
if not caller.endswith('server'): if not caller.endswith('server'):
output("") output("")
output("Command:") output("Command:")
@ -185,7 +185,7 @@ class Fail2banCmdLine():
if ret is not None: if ret is not None:
return ret return ret
logSys.debug("-- conf: %r, args: %r", self._conf, self._args) logSys.debug(" conf: %r, args: %r", self._conf, self._args)
if initial and PRODUCTION: # pragma: no cover - can't test if initial and PRODUCTION: # pragma: no cover - can't test
verbose = self._conf["verbose"] verbose = self._conf["verbose"]

View File

@ -46,7 +46,7 @@ class Fail2banServer(Fail2banCmdLine):
@staticmethod @staticmethod
def startServerDirect(conf, daemon=True): def startServerDirect(conf, daemon=True):
logSys.debug("-- direct starting of server in %s, deamon: %s", os.getpid(), daemon) logSys.debug(" direct starting of server in %s, deamon: %s", os.getpid(), daemon)
from ..server.server import Server from ..server.server import Server
server = None server = None
try: try:
@ -54,7 +54,7 @@ class Fail2banServer(Fail2banCmdLine):
# server object will internally fork self if daemon is True # server object will internally fork self if daemon is True
server = Server(daemon) server = Server(daemon)
server.start(conf["socket"], server.start(conf["socket"],
conf["pidfile"], conf["force"], conf["pidfile"], conf["force"],
conf=conf) conf=conf)
except Exception as e: # pragma: no cover except Exception as e: # pragma: no cover
try: try:
@ -79,7 +79,7 @@ class Fail2banServer(Fail2banCmdLine):
frk = not conf["async"] and PRODUCTION frk = not conf["async"] and PRODUCTION
if frk: # pragma: no cover if frk: # pragma: no cover
pid = os.fork() pid = os.fork()
logSys.debug("-- async starting of server in %s, fork: %s - %s", os.getpid(), frk, pid) logSys.debug(" async starting of server in %s, fork: %s - %s", os.getpid(), frk, pid)
if pid == 0: if pid == 0:
args = list() args = list()
args.append(SERVER) args.append(SERVER)