Revision c0088fb9

b/lib/mcpu.py
220 220
    logging.debug("Step %d/%d %s", current, total, message)
221 221
    self._feedback_fn("STEP %d/%d %s" % (current, total, message))
222 222

  
223
  def LogWarning(self, message, hint=None):
223
  def LogWarning(self, message, *args, **kwargs):
224 224
    """Log a warning to the logs and the user.
225 225

  
226
    """
227
    logging.warning(message)
228
    self._feedback_fn(" - WARNING: %s" % message)
229
    if hint:
230
      self._feedback_fn("      Hint: %s" % hint)
226
    The optional keyword argument is 'hint' and can be used to show a
227
    hint to the user (presumably related to the warning). If the
228
    message is empty, it will not be printed at all, allowing one to
229
    show only a hint.
231 230

  
232
  def LogInfo(self, message):
231
    """
232
    assert not kwargs or (len(kwargs) == 1 and "hint" in kwargs), \
233
           "Invalid keyword arguments for LogWarning (%s)" % str(kwargs)
234
    if args:
235
      message = message % tuple(args)
236
    if message:
237
      logging.warning(message)
238
      self._feedback_fn(" - WARNING: %s" % message)
239
    if "hint" in kwargs:
240
      self._feedback_fn("      Hint: %s" % kwargs["hint"])
241

  
242
  def LogInfo(self, message, *args):
233 243
    """Log an informational message to the logs and the user.
234 244

  
235 245
    """
246
    if args:
247
      message = message % tuple(args)
236 248
    logging.info(message)
237 249
    self._feedback_fn(" - INFO: %s" % message)
238 250

  

Also available in: Unified diff