Call the proper methods in PLogger. Also use ERR_PRINT when logging errors.

This commit is contained in:
Relintai 2023-10-25 01:43:37 +02:00
parent b4f0ef4493
commit fe717c76d8
2 changed files with 18 additions and 17 deletions

View File

@ -75,7 +75,7 @@ void PLogger::log_message(const String &str) {
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_message(s);
} }
void PLogger::log_message(const char *str) { void PLogger::log_message(const char *str) {
if (_log_level > LOG_LEVEL_MESSAGE) { if (_log_level > LOG_LEVEL_MESSAGE) {
@ -87,7 +87,7 @@ void PLogger::log_message(const char *str) {
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_message(s);
} }
void PLogger::log_message(const char *p_function, const char *p_file, int p_line, const char *str) { void PLogger::log_message(const char *p_function, const char *p_file, int p_line, const char *str) {
if (_log_level > LOG_LEVEL_MESSAGE) { if (_log_level > LOG_LEVEL_MESSAGE) {
@ -105,7 +105,7 @@ void PLogger::log_message(const char *p_function, const char *p_file, int p_line
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_message(s);
} }
void PLogger::log_message(const char *p_function, const char *p_file, int p_line, const String &str) { void PLogger::log_message(const char *p_function, const char *p_file, int p_line, const String &str) {
if (_log_level > LOG_LEVEL_MESSAGE) { if (_log_level > LOG_LEVEL_MESSAGE) {
@ -123,7 +123,7 @@ void PLogger::log_message(const char *p_function, const char *p_file, int p_line
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_message(s);
} }
void PLogger::log_warning(const String &str) { void PLogger::log_warning(const String &str) {
@ -136,7 +136,7 @@ void PLogger::log_warning(const String &str) {
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_warning(s);
} }
void PLogger::log_warning(const char *str) { void PLogger::log_warning(const char *str) {
if (_log_level > LOG_LEVEL_WARNING) { if (_log_level > LOG_LEVEL_WARNING) {
@ -148,7 +148,7 @@ void PLogger::log_warning(const char *str) {
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_warning(s);
} }
void PLogger::log_warning(const char *p_function, const char *p_file, int p_line, const char *str) { void PLogger::log_warning(const char *p_function, const char *p_file, int p_line, const char *str) {
if (_log_level > LOG_LEVEL_WARNING) { if (_log_level > LOG_LEVEL_WARNING) {
@ -166,7 +166,7 @@ void PLogger::log_warning(const char *p_function, const char *p_file, int p_line
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_warning(s);
} }
void PLogger::log_warning(const char *p_function, const char *p_file, int p_line, const String &str) { void PLogger::log_warning(const char *p_function, const char *p_file, int p_line, const String &str) {
if (_log_level > LOG_LEVEL_WARNING) { if (_log_level > LOG_LEVEL_WARNING) {
@ -184,7 +184,7 @@ void PLogger::log_warning(const char *p_function, const char *p_file, int p_line
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_warning(s);
} }
void PLogger::log_error(const String &str) { void PLogger::log_error(const String &str) {
@ -197,7 +197,7 @@ void PLogger::log_error(const String &str) {
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_error(s);
} }
void PLogger::log_error(const char *str) { void PLogger::log_error(const char *str) {
if (_log_level > LOG_LEVEL_ERROR) { if (_log_level > LOG_LEVEL_ERROR) {
@ -209,7 +209,7 @@ void PLogger::log_error(const char *str) {
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_error(s);
} }
void PLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *str) { void PLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *str) {
if (_log_level > LOG_LEVEL_ERROR) { if (_log_level > LOG_LEVEL_ERROR) {
@ -227,7 +227,7 @@ void PLogger::log_error(const char *p_function, const char *p_file, int p_line,
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_error(s);
} }
void PLogger::log_error(const char *p_function, const char *p_file, int p_line, const String &str) { void PLogger::log_error(const char *p_function, const char *p_file, int p_line, const String &str) {
if (_log_level > LOG_LEVEL_ERROR) { if (_log_level > LOG_LEVEL_ERROR) {
@ -245,7 +245,7 @@ void PLogger::log_error(const char *p_function, const char *p_file, int p_line,
s += str; s += str;
//s += "\n"; //s += "\n";
do_log_trace(s); do_log_error(s);
} }
void PLogger::do_log_trace(const String &str) { void PLogger::do_log_trace(const String &str) {
@ -276,7 +276,8 @@ void PLogger::do_log_error(const String &str) {
if (_backend.is_valid()) { if (_backend.is_valid()) {
_backend->log_error(str); _backend->log_error(str);
} else { } else {
print_line(str); ERR_PRINT(str);
//print_error(str);
} }
} }

View File

@ -7,13 +7,13 @@ void LoggerBackend::log_trace(const String &str) {
call("_log_trace", str); call("_log_trace", str);
} }
void LoggerBackend::log_message(const String &str) { void LoggerBackend::log_message(const String &str) {
call("_log_trace", str); call("_log_message", str);
} }
void LoggerBackend::log_warning(const String &str) { void LoggerBackend::log_warning(const String &str) {
call("_log_trace", str); call("_log_warning", str);
} }
void LoggerBackend::log_error(const String &str) { void LoggerBackend::log_error(const String &str) {
call("_log_trace", str); call("_log_error", str);
} }
void LoggerBackend::_log_trace(const String &str) { void LoggerBackend::_log_trace(const String &str) {
@ -26,7 +26,7 @@ void LoggerBackend::_log_warning(const String &str) {
print_line(str); print_line(str);
} }
void LoggerBackend::_log_error(const String &str) { void LoggerBackend::_log_error(const String &str) {
print_line(str); print_error(str);
} }
LoggerBackend::LoggerBackend() { LoggerBackend::LoggerBackend() {