diff options
Diffstat (limited to 'platform/uwp')
-rw-r--r-- | platform/uwp/os_uwp.cpp | 60 | ||||
-rw-r--r-- | platform/uwp/os_uwp.h | 4 |
2 files changed, 11 insertions, 53 deletions
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index b909ccccd6..031c714514 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -40,6 +40,7 @@ #include "platform/windows/packet_peer_udp_winsock.h" #include "platform/windows/stream_peer_winsock.h" #include "platform/windows/tcp_server_winsock.h" +#include "platform/windows/windows_terminal_logger.h" #include "project_settings.h" #include "servers/audio_server.h" #include "servers/visual/visual_server_raster.h" @@ -182,6 +183,13 @@ void OSUWP::initialize_core() { cursor_shape = CURSOR_ARROW; } +void OSUWP::initialize_logger() { + Vector<Logger *> loggers; + loggers.push_back(memnew(WindowsTerminalLogger)); + loggers.push_back(memnew(RotatedFileLogger("user://logs/log.txt"))); + _set_logger(memnew(CompositeLogger(loggers))); +} + bool OSUWP::can_draw() const { return !minimized; @@ -371,32 +379,6 @@ void OSUWP::finalize() { void OSUWP::finalize_core() { } -void OSUWP::vprint(const char *p_format, va_list p_list, bool p_stderr) { - - char buf[16384 + 1]; - int len = vsnprintf(buf, 16384, p_format, p_list); - if (len <= 0) - return; - buf[len] = 0; - - int wlen = MultiByteToWideChar(CP_UTF8, 0, buf, len, NULL, 0); - if (wlen < 0) - return; - - wchar_t *wbuf = (wchar_t *)malloc((len + 1) * sizeof(wchar_t)); - MultiByteToWideChar(CP_UTF8, 0, buf, len, wbuf, wlen); - wbuf[wlen] = 0; - - if (p_stderr) - fwprintf(stderr, L"%s", wbuf); - else - wprintf(L"%s", wbuf); - - free(wbuf); - - fflush(stdout); -}; - void OSUWP::alert(const String &p_alert, const String &p_title) { Platform::String ^ alert = ref new Platform::String(p_alert.c_str()); @@ -520,30 +502,6 @@ OS::VideoMode OSUWP::get_video_mode(int p_screen) const { void OSUWP::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const { } -void OSUWP::print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) { - - 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("ERROR: %s: %s\n", p_function, err_details); - print(" At: %s:%i\n", p_file, p_line); - break; - case ERR_WARNING: - print("WARNING: %s: %s\n", p_function, err_details); - print(" At: %s:%i\n", p_file, p_line); - break; - case ERR_SCRIPT: - print("SCRIPT ERROR: %s: %s\n", p_function, err_details); - print(" At: %s:%i\n", p_file, p_line); - break; - } -} - String OSUWP::get_name() { return "UWP"; @@ -890,6 +848,8 @@ OSUWP::OSUWP() { mouse_mode_changed = CreateEvent(NULL, TRUE, FALSE, L"os_mouse_mode_changed"); AudioDriverManager::add_driver(&audio_driver); + + _set_logger(memnew(WindowsTerminalLogger)); } OSUWP::~OSUWP() { diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index a7a5d32cb9..df38faa8e1 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -163,6 +163,7 @@ protected: virtual int get_audio_driver_count() const; virtual const char *get_audio_driver_name(int p_driver) const; + virtual void initialize_logger(); virtual void initialize_core(); virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver); @@ -180,9 +181,6 @@ public: // Event to send to the app wrapper HANDLE mouse_mode_changed; - void print_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type); - - virtual void vprint(const char *p_format, va_list p_list, bool p_stderr = false); virtual void alert(const String &p_alert, const String &p_title = "ALERT!"); String get_stdin_string(bool p_block); |