diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2015-11-05 20:13:05 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2015-11-10 18:29:34 +0100 |
commit | 6334895088947eb318c8df15d0a68db27819a06f (patch) | |
tree | bf216e54b139231daa5b5e5d6c16aab50fe5381f /platform/windows | |
parent | dde6396f221672d34d178c75f4080c1e87612aea (diff) |
Display error type (error, warning, script error) in OS::print_error
Previously all types of errors would be shown as ERROR, thus making for example warnings (WARN_PRINT) somewhat aggressive.
ERROR is displayed in red, WARNING in yellow and SCRIPT ERROR in magenta (though the latter does not seem used so far).
Fixes #1127.
Diffstat (limited to 'platform/windows')
-rw-r--r-- | platform/windows/os_windows.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index 438a5a6903..01a8261563 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1768,15 +1768,26 @@ void OS_Windows::print_error(const char* p_function,const char* p_file,int p_lin HANDLE hCon=GetStdHandle(STD_OUTPUT_HANDLE); if (!hCon || hCon==INVALID_HANDLE_VALUE) { - if (p_rationale && p_rationale[0]) { - - print("\E[1;31;40mERROR: %s: \E[1;37;40m%s\n",p_function,p_rationale); - print("\E[0;31;40m At: %s:%i.\E[0;0;37m\n",p_file,p_line); - } else { - print("\E[1;31;40mERROR: %s: \E[1;37;40m%s\n",p_function,p_code); - print("\E[0;31;40m At: %s:%i.\E[0;0;37m\n",p_file,p_line); + const char* err_details; + if (p_rationale && p_rationale[0]) + err_details=p_rationale; + else + err_details=p_code; + switch(p_type) { + case ERR_ERROR: + print("\E[1;31;40mERROR: %s: \E[1;37;40m%s\n",p_function,err_details); + print("\E[0;31;40m At: %s:%i.\E[0;0;37m\n",p_file,p_line); + break; + case ERR_WARNING: + print("\E[1;33;40mWARNING: %s: \E[1;37;40m%s\n",p_function,err_details); + print("\E[0;33;40m At: %s:%i.\E[0;0;37m\n",p_file,p_line); + break; + case ERR_SCRIPT: + print("\E[1;35;40mSCRIPT ERROR: %s: \E[1;37;40m%s\n",p_function,err_details); + print("\E[0;35;40m At: %s:%i.\E[0;0;37m\n",p_file,p_line); + break; } } else { |