cout.py 765 B

12345678910111213141516171819202122232425262728
  1. '''
  2. Created on 8/02/2013
  3. @author: konstaa
  4. '''
  5. SEVERITY_INFO = 0x01
  6. SEVERITY_WARNING = 0x02
  7. SEVERITY_ERROR = 0x03
  8. def cout(path, cursor, level, message, details):
  9. notification = path + ":" + str(cursor) + ": "
  10. if level == SEVERITY_INFO:
  11. notification += "info: "
  12. elif level == SEVERITY_WARNING:
  13. notification += "warning: "
  14. elif level == SEVERITY_ERROR:
  15. notification += "error: "
  16. else:
  17. assert(len("Invalid message severity level specified") == 0)
  18. notification += message + "\n"
  19. DETAILS_OFFSET = 15
  20. for each in details:
  21. notification += "\t" + str(each[0]) + (" " * (DETAILS_OFFSET - len(each[0]))) + ": " + str(each[1]) + "\n"
  22. print notification