2011-11-04 01:56:10 +08:00
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
def _write_message(kind, message):
|
2011-11-11 08:24:00 +08:00
|
|
|
program = os.path.basename(sys.argv[0])
|
2013-08-15 07:15:39 +08:00
|
|
|
sys.stderr.write('%s: %s: %s\n' % (program, kind, message))
|
2011-11-04 01:56:10 +08:00
|
|
|
|
|
|
|
note = lambda message: _write_message('note', message)
|
|
|
|
warning = lambda message: _write_message('warning', message)
|
|
|
|
error = lambda message: _write_message('error', message)
|
|
|
|
fatal = lambda message: (_write_message('fatal error', message), sys.exit(1))
|
|
|
|
|
|
|
|
__all__ = ['note', 'warning', 'error', 'fatal']
|