commandserver: turn server debug messages into logs
authorYuya Nishihara <yuya@tcha.org>
Sun, 18 Nov 2018 19:55:53 +0900
changeset 40828 25e9089c7686
parent 40827 d23fd01cc115
child 40829 77173267878b
commandserver: turn server debug messages into logs They were ui.debug() just because commandserver.log() was noop if no client connected.
mercurial/chgserver.py
mercurial/commandserver.py
tests/test-chg.t
--- a/mercurial/chgserver.py	Sun Nov 18 19:47:04 2018 +0900
+++ b/mercurial/chgserver.py	Sun Nov 18 19:55:53 2018 +0900
@@ -606,10 +606,11 @@
 
     def shouldexit(self):
         if not self._issocketowner():
-            self.ui.debug('%s is not owned, exiting.\n' % self._realaddress)
+            self.ui.log(b'chgserver', b'%s is not owned, exiting.\n',
+                        self._realaddress)
             return True
         if time.time() - self._lastactive > self._idletimeout:
-            self.ui.debug('being idle too long. exiting.\n')
+            self.ui.log(b'chgserver', b'being idle too long. exiting.\n')
             return True
         return False
 
--- a/mercurial/commandserver.py	Sun Nov 18 19:47:04 2018 +0900
+++ b/mercurial/commandserver.py	Sun Nov 18 19:55:53 2018 +0900
@@ -573,7 +573,8 @@
             pid = os.fork()
             if pid:
                 try:
-                    self.ui.debug('forked worker process (pid=%d)\n' % pid)
+                    self.ui.log(b'cmdserver',
+                                b'forked worker process (pid=%d)\n', pid)
                     self._workerpids.add(pid)
                     h.newconnection()
                 finally:
@@ -610,7 +611,7 @@
             if pid == 0:
                 # no waitable child processes
                 return
-            self.ui.debug('worker process exited (pid=%d)\n' % pid)
+            self.ui.log(b'cmdserver', b'worker process exited (pid=%d)\n', pid)
             self._workerpids.discard(pid)
 
     def _runworker(self, conn):
--- a/tests/test-chg.t	Sun Nov 18 19:47:04 2018 +0900
+++ b/tests/test-chg.t	Sun Nov 18 19:55:53 2018 +0900
@@ -230,9 +230,7 @@
 preserved:
 
   $ cat log/server.log.1 log/server.log | tail -10 | filterlog
-  YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ...
-  YYYY/MM/DD HH:MM:SS (PID)> validate: []
-  YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ...
+  YYYY/MM/DD HH:MM:SS (PID)> forked worker process (pid=...)
   YYYY/MM/DD HH:MM:SS (PID)> setprocname: ...
   YYYY/MM/DD HH:MM:SS (PID)> received fds: ...
   YYYY/MM/DD HH:MM:SS (PID)> chdir to '$TESTTMP/extreload'
@@ -240,3 +238,5 @@
   YYYY/MM/DD HH:MM:SS (PID)> setenv: ...
   YYYY/MM/DD HH:MM:SS (PID)> confighash = ... mtimehash = ...
   YYYY/MM/DD HH:MM:SS (PID)> validate: []
+  YYYY/MM/DD HH:MM:SS (PID)> worker process exited (pid=...)
+  YYYY/MM/DD HH:MM:SS (PID)> $TESTTMP/extreload/chgsock/server-... is not owned, exiting.