Use minetest logging facilities for irrlicht log output
authorShadowNinja <shadowninja@minetest.net>
Sat, 4 Jul 2015 22:53:38 +0000 (00:53 +0200)
committerest31 <MTest31@outlook.com>
Sat, 4 Jul 2015 23:05:24 +0000 (01:05 +0200)
src/client/inputhandler.h

index 7cd3ddc71f5127522cc4a66c3ea8d66e6ef07c99..3da856f7b80d0e25468e8d57494b953b8025830f 100644 (file)
@@ -85,10 +85,18 @@ public:
                                        mouse_wheel += event.MouseInput.Wheel;
                                }
                        }
-               }
-               if (event.EventType == irr::EET_LOG_TEXT_EVENT) {
-                       dstream << std::string("Irrlicht log: ") + std::string(event.LogEvent.Text)
-                               << std::endl;
+               } else if (event.EventType == irr::EET_LOG_TEXT_EVENT) {
+                       static const enum LogMessageLevel irr_loglev_conv[] = {
+                               LMT_VERBOSE, // ELL_DEBUG
+                               LMT_INFO, // ELL_INFORMATION
+                               LMT_ACTION, // ELL_WARNING
+                               LMT_ERROR, // ELL_ERROR
+                               LMT_ERROR, // ELL_NONE
+                       };
+                       assert(event.LogEvent.Level < sizeof(irr_loglev_conv));
+                       log_printline(irr_loglev_conv[event.LogEvent.Level],
+                               std::string("Irrlicht: ")
+                               + (const char*) event.LogEvent.Text);
                        return true;
                }
                /* always return false in order to continue processing events */