diff Platforms/Wasm/Defaults.cpp @ 603:70992b38aa8a

new routable logging system in STDIO mode + flag support (with no value) in StartupParametersBuilder + 80 col indent
author Benjamin Golinvaux <bgo@osimis.io>
date Mon, 29 Apr 2019 15:09:48 +0200
parents 79bb0a02d1cc
children 4f2416d519b4
line wrap: on
line diff
--- a/Platforms/Wasm/Defaults.cpp	Mon Apr 29 14:40:01 2019 +0200
+++ b/Platforms/Wasm/Defaults.cpp	Mon Apr 29 15:09:48 2019 +0200
@@ -5,9 +5,12 @@
 #include <Framework/dev.h>
 #include "Framework/Widgets/TestCairoWidget.h"
 #include <Framework/Viewport/WidgetViewport.h>
+#include <Applications/Wasm/StartupParametersBuilder.h>
+#include <Platforms/Wasm/WasmPlatformApplicationAdapter.h>
+#include <Core/Logging.h>
+
 #include <algorithm>
-#include "Applications/Wasm/StartupParametersBuilder.h"
-#include "Platforms/Wasm/WasmPlatformApplicationAdapter.h"
+
 
 static unsigned int width_ = 0;
 static unsigned int height_ = 0;
@@ -88,6 +91,10 @@
 
     printf("StartWasmApplication\n");
 
+    Orthanc::Logging::SetErrorWarnInfoTraceLoggingFunctions(
+      stone_console_error, stone_console_warning,
+      stone_console_info, stone_console_trace);
+
     // recreate a command line from uri arguments and parse it
     boost::program_options::variables_map parameters;
     boost::program_options::options_description options;
@@ -106,6 +113,16 @@
     printf("StartWasmApplication - completed\n");
   }
   
+  bool EMSCRIPTEN_KEEPALIVE WasmIsTraceLevelEnabled()
+  {
+    return Orthanc::Logging::IsTraceLevelEnabled();
+  }
+
+  bool EMSCRIPTEN_KEEPALIVE WasmIsInfoLevelEnabled()
+  {
+    return Orthanc::Logging::IsInfoLevelEnabled();
+  }
+  
   void EMSCRIPTEN_KEEPALIVE WasmDoAnimation()
   {
     for (auto viewport : viewports_) {