cout.py 1000 B

1234567891011121314151617181920212223242526272829
  1. #
  2. # Metrix++, Copyright 2009-2019, Metrix++ Project
  3. # Link: https://github.com/metrixplusplus/metrixplusplus
  4. #
  5. # This file is a part of Metrix++ Tool.
  6. #
  7. SEVERITY_INFO = 0x01
  8. SEVERITY_WARNING = 0x02
  9. SEVERITY_ERROR = 0x03
  10. DETAILS_OFFSET = 15
  11. def notify(path, cursor, level, message, details = [], indent = 0):
  12. notification = (". " * indent) + path + ":" + (str(cursor) if cursor != None else "") + ": "
  13. if level == SEVERITY_INFO:
  14. notification += "info: "
  15. elif level == SEVERITY_WARNING:
  16. notification += "warning: "
  17. elif level == SEVERITY_ERROR:
  18. notification += "error: "
  19. else:
  20. assert(len("Invalid message severity level specified") == 0)
  21. notification += message + "\n"
  22. for each in details:
  23. notification += ((" " * indent) + "\t" +
  24. str(each[0]) + (" " * (DETAILS_OFFSET - len(each[0]))) + ": " + str(each[1]) + "\n")
  25. print notification