diff options
author | JF Ding <jian-feng.ding@intel.com> | 2011-12-10 07:01:27 +0800 |
---|---|---|
committer | JF Ding <jian-feng.ding@intel.com> | 2011-12-10 07:01:27 +0800 |
commit | a4f547ca4a5e95fdd051b89e719d15810fb8c314 (patch) | |
tree | ce01397a56ffdaa5cbc8c3f7cb089642b9d544a0 | |
parent | 02ce6deea37295bcd247922eea86d9f77debc5f7 (diff) | |
download | mic-a4f547ca4a5e95fdd051b89e719d15810fb8c314.tar.gz mic-a4f547ca4a5e95fdd051b89e719d15810fb8c314.tar.bz2 mic-a4f547ca4a5e95fdd051b89e719d15810fb8c314.zip |
more precise place for catched errmsg
output the errmsg before the next line
-rw-r--r-- | mic/msger.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/mic/msger.py b/mic/msger.py index b33f1a3..9665af9 100644 --- a/mic/msger.py +++ b/mic/msger.py @@ -66,19 +66,25 @@ def _general_print(head, color, msg = None, stream = sys.stdout, level = 'normal # skip return + errormsg = '' if CATCHERR_BUFFILE_FD > 0: size = os.lseek(CATCHERR_BUFFILE_FD , 0, os.SEEK_END) os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_SET) errormsg = os.read(CATCHERR_BUFFILE_FD, size) os.ftruncate(CATCHERR_BUFFILE_FD, 0) - msg += errormsg if LOG_FILE_FP: + if errormsg: + LOG_CONTENT += errormsg + save_msg = msg.strip() if save_msg: timestr = datetime.now().strftime('[%m/%d %H:%M:%S] ') LOG_CONTENT += timestr + save_msg + '\n' + if errormsg: + _color_print('', NO_COLOR, errormsg, stream, level) + _color_print(head, color, msg, stream, level) def _color_print(head, color, msg, stream, level): |