klepto2 Posted October 25, 2023 Share Posted October 25, 2023 As i am currently working on a cli tool, i found that the constant "spamming" of UltraEngine logs is quite annoying. While these messages are good for debugging or even for release builds,It would by nice to disable them, or redirect them. Espescially the messages with just an infomative character should be optional, like "Texture xxx loaded..." othe messages like errors should go to the stderr and everything else should be managed by the developer. Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted October 25, 2023 Share Posted October 25, 2023 Paste in the console: function hook() return false end ListenEvent(EVENT_PRINT, nil, hook) Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
klepto2 Posted October 26, 2023 Author Share Posted October 26, 2023 15 hours ago, Josh said: Paste in the console: function hook() return false end ListenEvent(EVENT_PRINT, nil, hook) ok, this prevents any message to be displayed. So, if i want to still use Output i need to write my own print functions, but this is an unforunate step maybe the print functions need an optional source parameter. In case someone wants a small sample: bool PrintHook(const Event& ev, shared_ptr<Object> extra) { if (ev.data == 1) { fwprintf(stdout, ev.text.c_str()); fflush(stdout); return true; } return false; } void PrintLog(const std::string& s) { EmitEvent(EVENT_PRINT, 0, 1, 0, 0, 0, 0, 0, s); } void PrintLog(const String& s) { PrintLog(std::string(s)); } void PrintLog(const WString& s, const bool linereturn = true) { EmitEvent(EVENT_PRINT, 0, 1, 0, 0, 0, 0, 0, s + (linereturn ? "\n" : "")); }; void PrintLog(const unsigned int i, const bool linereturn = true) { PrintLog(WString(i), linereturn); } void PrintLog(const uint64_t i, const bool linereturn = true) { PrintLog(WString(i), linereturn); } void PrintLog(const int i, const bool linereturn = true) { PrintLog(WString(i), linereturn); } void PrintLog(const float i, const bool linereturn = true) { PrintLog(WString(i), linereturn); } void PrintLog(const double i, const bool linereturn = true) { PrintLog(WString(i), linereturn); } void PrintLog(const bool i, const bool linereturn = true) { PrintLog(WString(i), linereturn); } void PrintLog(const char* i, const bool linereturn = true) { PrintLog(WString(i), linereturn); } void PrintLog(const wchar_t* i, const bool linereturn = true) { PrintLog(WString(i), linereturn); } void PrintLog(const table& t) { PrintLog(string(t)); } int main(int argc, const char* argv[]) { ListenEvent(EVENT_PRINT, NULL, PrintHook); PrintLog("My-Message"); return 0; } Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted October 26, 2023 Share Posted October 26, 2023 Sorry, I should have mentioned that event.text will contain the printed text, so you can use that to filter which messages get printed and which get skipped. Return true and the message will go into the Print routine. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted October 27, 2023 Share Posted October 27, 2023 Also, I should mention the LOAD_QUIET load flag will cause asset loading messages to not print. Generally, these get passed along when an auxillary asset is loaded, so if you pass LOAD_QUIET to LoadModel it won't print texture loading messages. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
klepto2 Posted October 27, 2023 Author Share Posted October 27, 2023 13 hours ago, Josh said: Sorry, I should have mentioned that event.text will contain the printed text, so you can use that to filter which messages get printed and which get skipped. Return true and the message will go into the Print routine. Well, no need for mentioning it. It was very obvious Filtering is very difficult with the current log messages, maybe the engine logging should be something like this: "[UltraEngine] Timestamp : Texture "xyz" loaded. This way a developer could simply filter out everything which begins with "[UltraEngine]", otherwise this could collide with mesages intended by the developer. Another way, which might be useful is some kind of log format setting. A simple function ptr which receives the msg and outputs a custom formatted msg. (Could be added to EngineSettings) 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.