Skip to content

Commit

Permalink
Add logging fun
Browse files Browse the repository at this point in the history
Signed-off-by: Vadim Markovtsev <vadim@sourced.tech>
  • Loading branch information
vmarkovtsev committed Dec 10, 2018
1 parent 4b891e9 commit f3e5943
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modelforge/slogging.py
Expand Up @@ -26,6 +26,14 @@ def get_timezone() -> Tuple[datetime.tzinfo, str]:


timezone, tzstr = get_timezone()
_now = datetime.datetime.now()
if _now.month == 12:
_fest = "🎅"
elif _now.month == 10 and _now.day > (31 - 7):
_fest = "🎃"
else:
_fest = ""
del _now


def format_datetime(dt: datetime.datetime):
Expand Down Expand Up @@ -106,6 +114,7 @@ def formatMessage(self, record: logging.LogRecord) -> str:
fmt = "\033[" + level_color + \
"m%(levelname)s\033[0m:%(rthread)s:%(name)s:\033[" + text_color + \
"m%(message)s\033[0m"
fmt = _fest + fmt
record.rthread = reduce_thread_id(record.thread)
return fmt % record.__dict__

Expand Down

0 comments on commit f3e5943

Please sign in to comment.