From e7691b31e928f2ce2dea5b69dc5d2460e945ad84 Mon Sep 17 00:00:00 2001 From: linlin Date: Sun, 4 Oct 2020 19:17:15 +0200 Subject: [PATCH] New translations logger2file.py (French) --- lang/fr/gklearn/utils/logger2file.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 lang/fr/gklearn/utils/logger2file.py diff --git a/lang/fr/gklearn/utils/logger2file.py b/lang/fr/gklearn/utils/logger2file.py new file mode 100644 index 0000000..2c7fc0b --- /dev/null +++ b/lang/fr/gklearn/utils/logger2file.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Fri Nov 8 14:21:25 2019 + +@author: ljia +""" + +import sys +import time + +class Logger(object): + def __init__(self): + self.terminal = sys.stdout + self.log = open("log." + str(time.time()) + ".log", "a") + + def write(self, message): + self.terminal.write(message) + self.log.write(message) + + def flush(self): + #this flush method is needed for python 3 compatibility. + #this handles the flush command by doing nothing. + #you might want to specify some extra behavior here. + pass + +sys.stdout = Logger() \ No newline at end of file