Implement all the logging methods.

This commit is contained in:
Relintai 2022-06-11 18:01:27 +02:00
parent f3373e0fa4
commit f911a9b363

View File

@ -8,7 +8,7 @@ void PLogger::log_trace(const String &str) {
String s; String s;
s += "T "; s += "T ";
s += str; s += str;
s += "\n"; //s += "\n";
do_log_trace(s); do_log_trace(s);
} }
@ -16,7 +16,7 @@ void PLogger::log_trace(const char *str) {
String s; String s;
s += "T "; s += "T ";
s += str; s += str;
s += "\n"; //s += "\n";
do_log_trace(s); do_log_trace(s);
} }
@ -27,43 +27,161 @@ void PLogger::log_trace(const char *p_function, const char *p_file, int p_line,
s += "::"; s += "::";
s += p_function; s += p_function;
s += ":"; s += ":";
s += p_line; s += String::num(p_line);
s += " | "; s += " | ";
s += str; s += str;
s += "\n"; //s += "\n";
do_log_trace(s); do_log_trace(s);
printf("T | %s::%s:%d | %s\n", p_file, p_function, p_line, str);
} }
void PLogger::log_trace(const char *p_function, const char *p_file, int p_line, const String &str) { void PLogger::log_trace(const char *p_function, const char *p_file, int p_line, const String &str) {
String s;
s += "T | ";
s += p_file;
s += "::";
s += p_function;
s += ":";
s += String::num(p_line);
s += " | ";
s += str;
//s += "\n";
do_log_trace(s);
} }
void PLogger::log_message(const String &str) { void PLogger::log_message(const String &str) {
String s;
s += "M ";
s += str;
//s += "\n";
do_log_trace(s);
} }
void PLogger::log_message(const char *str) { void PLogger::log_message(const char *str) {
String s;
s += "M ";
s += str;
//s += "\n";
do_log_trace(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) {
String s;
s += "M | ";
s += p_file;
s += "::";
s += p_function;
s += ":";
s += String::num(p_line);
s += " | ";
s += str;
//s += "\n";
do_log_trace(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) {
String s;
s += "M | ";
s += p_file;
s += "::";
s += p_function;
s += ":";
s += String::num(p_line);
s += " | ";
s += str;
//s += "\n";
do_log_trace(s);
} }
void PLogger::log_warning(const String &str) { void PLogger::log_warning(const String &str) {
String s;
s += "W ";
s += str;
//s += "\n";
do_log_trace(s);
} }
void PLogger::log_warning(const char *str) { void PLogger::log_warning(const char *str) {
String s;
s += "W ";
s += str;
//s += "\n";
do_log_trace(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) {
String s;
s += "W | ";
s += p_file;
s += "::";
s += p_function;
s += ":";
s += String::num(p_line);
s += " | ";
s += str;
//s += "\n";
do_log_trace(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) {
String s;
s += "W | ";
s += p_file;
s += "::";
s += p_function;
s += ":";
s += String::num(p_line);
s += " | ";
s += str;
//s += "\n";
do_log_trace(s);
} }
void PLogger::log_error(const String &str) { void PLogger::log_error(const String &str) {
String s;
s += "E ";
s += str;
//s += "\n";
do_log_trace(s);
} }
void PLogger::log_error(const char *str) { void PLogger::log_error(const char *str) {
String s;
s += "E ";
s += str;
//s += "\n";
do_log_trace(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) {
String s;
s += "E | ";
s += p_file;
s += "::";
s += p_function;
s += ":";
s += String::num(p_line);
s += " | ";
s += str;
//s += "\n";
do_log_trace(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) {
String s;
s += "E | ";
s += p_file;
s += "::";
s += p_function;
s += ":";
s += String::num(p_line);
s += " | ";
s += str;
//s += "\n";
do_log_trace(s);
} }
void PLogger::do_log_trace(const String &str) { void PLogger::do_log_trace(const String &str) {