Changeset 349:41c486c8a0b4 for src/mlx/logger.py
- Timestamp:
- 12/10/12 19:28:32 (11 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/logger.py
r346 r349 97 97 98 98 def copy(self, timestamp = None, clearTimestamp = False, text = None, 99 fault Score = None):99 faultID = None, faultScore = None, clearFault = False): 100 100 """Create a copy of this entry with the given values changed.""" 101 assert faultScore is None or self._faultID is not None102 103 101 return Logger.Entry(None if clearTimestamp 104 102 else self._timestamp if timestamp is None … … 109 107 showTimestamp = self._showTimestamp, 110 108 111 faultID = self._faultID, 109 faultID = 110 None if clearFault 111 else self._faultID if faultID is None 112 else faultID, 112 113 113 114 faultScore = 114 self._faultScore if faultScore is None 115 None if clearFault 116 else self._faultScore if faultScore is None 115 117 else faultScore, 116 118 … … 248 250 249 251 def fault(self, faultID, timestamp, what, score, 250 updatePrevious = False ):252 updatePrevious = False, updateID = None): 251 253 """Report a fault. 252 254 … … 262 264 and the new score is not greater than the latest one, the ID of the 263 265 latest one is returned. 266 267 If updateID is given, the log entry with the given ID will be 268 'upgraded' to be a fault with the given data. 264 269 265 270 Returns an ID of the fault, or -1 if it was not logged.""" … … 279 284 faultScore = score) 280 285 self._updateEntry(id, newEntry) 286 elif updateID is not None: 287 id = updateID 288 newEntry = self._entries[id].copy(timestamp = timestamp, 289 text = text, faultID = faultID, 290 faultScore = score) 291 self._updateEntry(id, newEntry) 281 292 else: 282 293 id = self._addEntry(Logger.Entry(timestamp, text, faultID = faultID, 283 294 faultScore = score)) 284 295 285 (messageType, duration) = (const.MESSAGETYPE_NOGO, 10) \ 286 if score==Logger.NO_GO_SCORE \ 287 else (const.MESSAGETYPE_FAULT, 5) 288 sendMessage(messageType, text, duration) 296 if updateID is None: 297 (messageType, duration) = (const.MESSAGETYPE_NOGO, 10) \ 298 if score==Logger.NO_GO_SCORE \ 299 else (const.MESSAGETYPE_FAULT, 5) 300 sendMessage(messageType, text, duration) 289 301 290 302 return id … … 311 323 self._updateEntry(id, self._entries[id].copy(text = line)) 312 324 325 def clearFault(self, id, text): 326 """Update the line with the given ID to contain the given string, 327 and clear its fault state.""" 328 newEntry = self._entries[id].copy(text = text, clearFault = True) 329 self._updateEntry(id, newEntry) 330 313 331 def _addEntry(self, entry): 314 332 """Add the given entry to the log.
Note:
See TracChangeset
for help on using the changeset viewer.