projects
/
rarslave2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[RARSLAVE] Remove id requirement from RarslaveLogger
[rarslave2.git]
/
RarslaveLogger.py
diff --git
a/RarslaveLogger.py
b/RarslaveLogger.py
index
83752f0
..
06b59a6
100644
(file)
--- a/
RarslaveLogger.py
+++ b/
RarslaveLogger.py
@@
-19,49
+19,25
@@
class RarslaveLogger (object):
# It will then be able to print all of them out.
def __init__ (self):
# It will then be able to print all of them out.
def __init__ (self):
- self.__m
sg_dict = {}
+ self.__m
essages = []
- def __get_key (self, id):
- """__get_key (id) -> key"""
- # Get a valid key which will always be the same as any other similar key, even if
- # the actual memory reference is different.
- return str(id)
-
- def addMessage (self, id, msg, printquiet=True):
+ def addMessage (self, msg, printquiet=True):
# Add a message to the dictionary, to be printed later.
# The printquiet variable controls whether the message will be printed
# normally, or only in verbose mode. The default is to print always.
# Add a message to the dictionary, to be printed later.
# The printquiet variable controls whether the message will be printed
# normally, or only in verbose mode. The default is to print always.
- # Get the key
- key = self.__get_key (id)
-
- # Create the dictionary entry if necessary
- if key not in self.__msg_dict.keys():
- self.__msg_dict[key] = []
-
- # Get the list from the dictionary, then add the message to it
- self.__msg_dict[key].append (RarslaveMessage (msg, printquiet))
+ self.__messages.append (RarslaveMessage (msg, printquiet))
def printAllMessages (self, verbose=False):
def printAllMessages (self, verbose=False):
- # Print all messages in groups by id
- for k in self.__msg_dict.keys():
- for msg in self.__msg_dict[k]:
-
- # Skip verbose messages if we're not in verbose mode
- if msg.isVerbose() and not verbose:
- continue
-
- print msg
+ for msg in self.__messages:
+ # Skip verbose messages if we're not in verbose mode
+ if msg.isVerbose() and not verbose:
+ continue
- print
+ print
msg
def main ():
def main ():
- logger = RarslaveLogger ()
- logger.addMessage (1, 'hello 1')
- logger.addMessage (2, 'hello 2')
- logger.addMessage (2, 'world 2')
- logger.addMessage (1, 'world 1')
- logger.printAllMessages ()
+ pass
if __name__ == '__main__':
main ()
if __name__ == '__main__':
main ()