diff options
author | Lars-Dominik Braun <lars@6xq.net> | 2018-09-25 16:16:31 +0200 |
---|---|---|
committer | Lars-Dominik Braun <lars@6xq.net> | 2018-09-25 16:16:31 +0200 |
commit | 329de53c7c8cea725249089df87d6cd9823f6972 (patch) | |
tree | 907ce5c7d86252b0187ac3a89034c1e9c41fefb5 /crocoite | |
parent | fd383fd5f5bac0a4cebbacf7e1ffccfd0be04e50 (diff) | |
download | crocoite-329de53c7c8cea725249089df87d6cd9823f6972.tar.gz crocoite-329de53c7c8cea725249089df87d6cd9823f6972.tar.bz2 crocoite-329de53c7c8cea725249089df87d6cd9823f6972.zip |
Immediately flush logger
Consumers can read the latest gossip faster now.
Diffstat (limited to 'crocoite')
-rw-r--r-- | crocoite/logger.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crocoite/logger.py b/crocoite/logger.py index 4b43e02..e8ff594 100644 --- a/crocoite/logger.py +++ b/crocoite/logger.py @@ -97,6 +97,7 @@ class PrintConsumer (Consumer): def __call__ (self, **kwargs): sys.stderr.write (str (kwargs)) sys.stderr.write ('\n') + sys.stderr.flush () return kwargs class JsonEncoder (json.JSONEncoder): @@ -118,6 +119,7 @@ class JsonPrintConsumer (Consumer): if kwargs['level'] >= self.minLevel: json.dump (kwargs, sys.stdout, cls=JsonEncoder) sys.stdout.write ('\n') + sys.stdout.flush () return kwargs class DatetimeConsumer (Consumer): |