Skip to content

Commit d64b68d

Browse files
Add implementations of loggin function.
1 parent f8b38f7 commit d64b68d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

classdesc.h

+14-2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ namespace
3232
#include <stdexcept>
3333
#include <memory>
3434
#include <climits>
35+
#include <iostream>
36+
37+
#ifdef __EMSCRIPTEN__
38+
#include <emscripten/console.h>
39+
#endif
3540

3641
#ifdef __CYGWIN__
3742
namespace std
@@ -1123,8 +1128,15 @@ namespace classdesc
11231128
template <> string enumKey<RESTProcessType::Type >(int x){return enum_keysData<RESTProcessType::Type >::keys(x);}
11241129
}
11251130

1126-
/// and undefined hook to allow logging to console in an emscripten environment.
1127-
void log(const std::string&);
1131+
/// allow logging to console in an emscripten environment.
1132+
inline void log(const std::string& msg)
1133+
{
1134+
#ifdef __EMSCRIPTEN__
1135+
emscripten_console_log(msg.c_str());
1136+
#else
1137+
std::cout<<msg<<std::endl;
1138+
#endif
1139+
}
11281140
}
11291141

11301142

0 commit comments

Comments
 (0)