Binder class for the logger.

This commit is contained in:
Relintai 2022-06-11 17:15:51 +02:00
parent 7d60706249
commit fb125bac9d
2 changed files with 126 additions and 0 deletions

76
core/log/logger_bind.cpp Normal file
View File

@ -0,0 +1,76 @@
#include "logger_bind.h"
#include "logger.h"
Ref<LoggerBackend> _PLogger::get_backend() {
return PLogger::_backend;
}
void _PLogger::set_backend(const Ref<LoggerBackend> &backend) {
PLogger::_backend = backend;
}
void _PLogger::log_trace(const String &str) {
PLogger::log_trace(str);
}
void _PLogger::log_trace(const char *str) {
PLogger::log_trace(str);
}
void _PLogger::log_trace(const char *p_function, const char *p_file, int p_line, const char *str) {
PLogger::log_trace(p_function, p_file, p_line, str);
}
void _PLogger::log_trace(const char *p_function, const char *p_file, int p_line, const String &str) {
PLogger::log_trace(p_function, p_file, p_line, str);
}
void _PLogger::log_message(const String &str) {
PLogger::log_message(str);
}
void _PLogger::log_message(const char *str) {
PLogger::log_message(str);
}
void _PLogger::log_message(const char *p_function, const char *p_file, int p_line, const char *str) {
PLogger::log_message(p_function, p_file, p_line, str);
}
void _PLogger::log_message(const char *p_function, const char *p_file, int p_line, const String &str) {
PLogger::log_message(p_function, p_file, p_line, str);
}
void _PLogger::log_warning(const String &str) {
PLogger::log_warning(str);
}
void _PLogger::log_warning(const char *str) {
PLogger::log_warning(str);
}
void _PLogger::log_warning(const char *p_function, const char *p_file, int p_line, const char *str) {
PLogger::log_warning(p_function, p_file, p_line, str);
}
void _PLogger::log_warning(const char *p_function, const char *p_file, int p_line, const String &str) {
PLogger::log_warning(p_function, p_file, p_line, str);
}
void _PLogger::log_error(const String &str) {
PLogger::log_error(str);
}
void _PLogger::log_error(const char *str) {
PLogger::log_error(str);
}
void _PLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *str) {
PLogger::log_error(p_function, p_file, p_line, str);
}
void _PLogger::log_error(const char *p_function, const char *p_file, int p_line, const String &str) {
PLogger::log_error(p_function, p_file, p_line, str);
}
_PLogger *_PLogger::get_singleton() {
return _self;
}
_PLogger::_PLogger() {
_self = this;
}
_PLogger::~_PLogger() {
_self = nullptr;
}
_PLogger *_PLogger::_self = nullptr;

50
core/log/logger_bind.h Normal file
View File

@ -0,0 +1,50 @@
#ifndef PLOGGER_BIND_H
#define PLOGGER_BIND_H
#include "core/reference.h"
#include "core/typedefs.h"
#include "core/ustring.h"
#include "logger_backend.h"
class String;
class _PLogger : public Object {
GDCLASS(_PLogger, Object);
public:
Ref<LoggerBackend> get_backend();
void set_backend(const Ref<LoggerBackend> &backend);
void log_trace(const String &str);
void log_trace(const char *str);
void log_trace(const char *p_function, const char *p_file, int p_line, const String &str);
void log_trace(const char *p_function, const char *p_file, int p_line, const char *str);
void log_message(const String &str);
void log_message(const char *str);
void log_message(const char *p_function, const char *p_file, int p_line, const String &str);
void log_message(const char *p_function, const char *p_file, int p_line, const char *str);
void log_warning(const String &str);
void log_warning(const char *str);
void log_warning(const char *p_function, const char *p_file, int p_line, const String &str);
void log_warning(const char *p_function, const char *p_file, int p_line, const char *str);
void log_error(const String &str);
void log_error(const char *str);
void log_error(const char *p_function, const char *p_file, int p_line, const char *str);
void log_error(const char *p_function, const char *p_file, int p_line, const String &str);
static _PLogger *get_singleton();
_PLogger();
~_PLogger();
protected:
static void _bind_methods();
static _PLogger *_self;
};
#endif