explicitly flush stdout in log()
authorTomas Vondra <tomas@2ndquadrant.com>
Thu, 13 Oct 2016 11:47:33 +0000 (13:47 +0200)
committerTomas Vondra <tomas@2ndquadrant.com>
Mon, 27 Feb 2017 00:32:51 +0000 (01:32 +0100)
Otherwise the messages may get buffered for a quite long time, which
is annoying, particularly in multi-process system.

client/utils/logging.py

index 9e12c887decff12bac06e9260e9ada52dbdde314..964480f802cbd539ae1fd44cbb63bdbb6be1de5c 100644 (file)
@@ -1,3 +1,4 @@
+import sys
 import time
 
 def log(message):
@@ -7,3 +8,5 @@ def log(message):
                'epoch' : time.time(),
                'date' : time.strftime('%Y-%m-%d %H:%M:%S'),
                'message' : message}
+
+       sys.stdout.flush()