cout.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #
  2. # Metrix++, Copyright 2009-2013, Metrix++ Project
  3. # Link: http://metrixplusplus.sourceforge.net
  4. #
  5. # This file is a part of Metrix++ Tool.
  6. #
  7. # Metrix++ is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, version 3 of the License.
  10. #
  11. # Metrix++ is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with Metrix++. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. SEVERITY_INFO = 0x01
  20. SEVERITY_WARNING = 0x02
  21. SEVERITY_ERROR = 0x03
  22. def cout(path, cursor, level, message, details):
  23. notification = path + ":" + str(cursor) + ": "
  24. if level == SEVERITY_INFO:
  25. notification += "info: "
  26. elif level == SEVERITY_WARNING:
  27. notification += "warning: "
  28. elif level == SEVERITY_ERROR:
  29. notification += "error: "
  30. else:
  31. assert(len("Invalid message severity level specified") == 0)
  32. notification += message + "\n"
  33. DETAILS_OFFSET = 15
  34. for each in details:
  35. notification += "\t" + str(each[0]) + (" " * (DETAILS_OFFSET - len(each[0]))) + ": " + str(each[1]) + "\n"
  36. print notification