Skip to content

Commit f79a6d8

Browse files
committed
Expose the stamp string of the FileLogger class
1 parent 86ad10a commit f79a6d8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

preditor/debug.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@ def clear(self, stamp=False):
2121
"""Removes the contents of the log file."""
2222
open(self._logfile, 'w').close()
2323
if stamp:
24-
msg = '--------- Date: {today} Version: {version} ---------'
25-
print(msg.format(today=datetime.datetime.today(), version=sys.version))
24+
print(self.stamp())
2625

2726
def flush(self):
28-
self._stdhandle.flush()
27+
if self._stdhandle:
28+
self._stdhandle.flush()
29+
30+
def stamp(self):
31+
msg = '--------- Date: {today} Version: {version} ---------'
32+
return msg.format(today=datetime.datetime.today(), version=sys.version)
2933

3034
def write(self, msg):
3135
f = open(self._logfile, 'a')

0 commit comments

Comments
 (0)