-
Notifications
You must be signed in to change notification settings - Fork 15
/
logger.py
50 lines (42 loc) · 1.56 KB
/
logger.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import abc
class Logger(object):
__metaclass__ = abc.ABCMeta
@abc.abstractmethod
def print_lots(self,
message,
lots,
loss_lots=None,
split_off_loss_lots=None,
replacement_lots=None,
split_off_replacement_lots=None):
"""Prints out the lots, along with the provided message.
Args:
message: A string to print before the lots.
lots: A Lots object.
loss_lots: A list of Lot objects to highlight.
split_off_loss_lots: A list of Lot objects to highlight.
replacement_lots: A list of Lot objects to highlight.
split_off_replacement_lots: A list of Lot objects to highlight.
"""
raise NotImplementedError()
class TermLogger(Logger):
def print_lots(self,
message,
lots,
loss_lots=None,
split_off_loss_lots=None,
replacement_lots=None,
split_off_replacement_lots=None):
print ''
lots.do_print(loss_lots, split_off_loss_lots, replacement_lots,
split_off_replacement_lots)
raw_input(message + '. Hit enter to continue>')
class NullLogger(Logger):
def print_lots(self,
message,
lots,
loss_lots=None,
split_off_loss_lots=None,
replacement_lots=None,
split_off_replacement_lots=None):
pass