diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-09-14 12:05:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-14 12:05:57 +0200 |
commit | 6ee1b786243e27271bfd62c9d70260cad421a3c4 (patch) | |
tree | f7ee2788dd080adf927226dc6ddf1724187ae9b9 | |
parent | 8818a93a3cc861144ab337401e00a3d1f5f549b2 (diff) | |
parent | c15fb42d450ce303be6373f486e8bc0a230a5829 (diff) |
Merge pull request #42042 from tdaffin/log_fatal_mono_errors
Add mono log message to error for fatal errors
-rw-r--r-- | modules/mono/mono_gd/gd_mono_log.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/modules/mono/mono_gd/gd_mono_log.cpp b/modules/mono/mono_gd/gd_mono_log.cpp index c5a988b8c3..b8ee0204c4 100644 --- a/modules/mono/mono_gd/gd_mono_log.cpp +++ b/modules/mono/mono_gd/gd_mono_log.cpp @@ -64,25 +64,32 @@ static int get_log_level_id(const char *p_log_level) { return -1; } +static String make_text(const char *log_domain, const char *log_level, const char *message) { + String text(message); + text += " (in domain "; + text += log_domain; + if (log_level) { + text += ", "; + text += log_level; + } + text += ")"; + return text; +} + void GDMonoLog::mono_log_callback(const char *log_domain, const char *log_level, const char *message, mono_bool fatal, void *) { FileAccess *f = GDMonoLog::get_singleton()->log_file; if (GDMonoLog::get_singleton()->log_level_id >= get_log_level_id(log_level)) { - String text(message); - text += " (in domain "; - text += log_domain; - if (log_level) { - text += ", "; - text += log_level; - } - text += ")\n"; + String text = make_text(log_domain, log_level, message); + text += "\n"; f->seek_end(); f->store_string(text); } if (fatal) { - ERR_PRINT("Mono: FATAL ERROR, ABORTING! Logfile: '" + GDMonoLog::get_singleton()->log_file_path + "'."); + String text = make_text(log_domain, log_level, message); + ERR_PRINT("Mono: FATAL ERROR '" + text + "', ABORTING! Logfile: '" + GDMonoLog::get_singleton()->log_file_path + "'."); // Make sure to flush before aborting f->flush(); f->close(); |