Commit bf4b9124 authored by Clément Haëck's avatar Clément Haëck
Browse files

Test logger class for messages

parent 2b124dc0
......@@ -243,3 +243,27 @@ def fix_time_daily(*datasets):
if len(out) == 1:
return out[0]
return out
class Logger:
MSG_END_DEF = "done"
def __init__(self, msg: str = None):
self.in_progress = False
if msg:
self.msg(msg)
@staticmethod
def _msg(msg: str):
print(msg, end='', flush=True)
def msg(self, msg: str = None, msg_end: str = None):
if self.in_progress:
self.end(msg_end)
self._msg(msg+'...')
self.in_progress = True
def end(self, msg_end: str = None):
if msg_end is None:
msg_end = self.MSG_END_DEF
print(msg_end)
self.in_progress = False
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment