2 # vim: set ts=4 sts=4 sw=4 textwidth=92:
4 class RarslaveMessage (object):
5 def __init__ (self, msg, printquiet):
7 self.printquiet = printquiet
10 return "%s" % self.msg
13 # A message is verbose only if we should
14 # print it when we are not printing quietly
15 return not self.printquiet
17 class RarslaveLogger (object):
18 # This class will log multiple messages, one for each set that is operated on.
19 # It will then be able to print all of them out.
24 def addMessage (self, msg, printquiet=True):
25 # Add a message to the dictionary, to be printed later.
26 # The printquiet variable controls whether the message will be printed
27 # normally, or only in verbose mode. The default is to print always.
29 self.__messages.append (RarslaveMessage (msg, printquiet))
31 def printAllMessages (self, verbose=False):
32 for msg in self.__messages:
33 # Skip verbose messages if we're not in verbose mode
34 if msg.isVerbose() and not verbose:
42 if __name__ == '__main__':