1234567891011121314151617181920212223242526272829303132333435363738394041 |
- SEVERITY_INFO = 0x01
- SEVERITY_WARNING = 0x02
- SEVERITY_ERROR = 0x03
- DETAILS_OFFSET = 15
- def notify(path, cursor, level, message, details = [], indent = 0):
- notification = (". " * indent) + path + ":" + str(cursor) + ": "
- if level == SEVERITY_INFO:
- notification += "info: "
- elif level == SEVERITY_WARNING:
- notification += "warning: "
- elif level == SEVERITY_ERROR:
- notification += "error: "
- else:
- assert(len("Invalid message severity level specified") == 0)
- notification += message + "\n"
- for each in details:
- notification += ((" " * indent) + "\t" +
- str(each[0]) + (" " * (DETAILS_OFFSET - len(each[0]))) + ": " + str(each[1]) + "\n")
-
- print notification
|