Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sommerda committed Sep 20, 2018
1 parent a4d6fbd commit a9f2645
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion privacy_webpage/core/probabilitybuckets_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import pickle
import errno
import xxhash
import sys


class ProbabilityBuckets:
Expand Down Expand Up @@ -62,9 +63,12 @@ def __init__(self,

def logger_setup(self, level):
self.logger = logging.getLogger(__name__) # all instances use the same logger. Randomize the name if not appreciated
# hack to make it work with web page stdout redirect
for hdlr in self.logger.handlers:
self.logger.removeHandler(hdlr)
if not len(self.logger.handlers):
self.logger.setLevel(level=level)
ch = logging.StreamHandler()
ch = logging.StreamHandler(sys.stdout)
ch.setLevel(level=level)
ch.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s: %(message)s'))
self.logger.addHandler(ch)
Expand Down

0 comments on commit a9f2645

Please sign in to comment.