void Log(LogLevel level, const std::string &message, const char *functionName, const char *sourceFile, unsigned int lineNumber) { int flags; const char *levelName; switch (level) { case LogLevel_Fatal: flags = EM_LOG_CONSOLE | EM_LOG_ERROR; levelName = "[FATAL]"; break; case LogLevel_Error: flags = EM_LOG_CONSOLE | EM_LOG_ERROR; levelName = "[ERROR]"; break; case LogLevel_Warning: flags = EM_LOG_CONSOLE | EM_LOG_WARN; levelName = "[WARNING]"; break; case LogLevel_Info: flags = EM_LOG_CONSOLE; levelName = "[INFO]"; break; case LogLevel_Log: flags = EM_LOG_CONSOLE; levelName = "[LOG]"; break; case LogLevel_Assert: flags = EM_LOG_CONSOLE | EM_LOG_ERROR; levelName = "[ASSERT]"; break; } emscripten_log(flags, "%s %s\n\nFunction: %s\nSource file: %s\nLine: %i", levelName, message.c_str(), functionName, sourceFile, lineNumber); }
int main () { int width, height; float ratio; switch(pt_app_initialize()) { case PT_INIT_GLFW_FAILURE: emscripten_log(EM_LOG_ERROR, "Error while initializing GLFW"); return EXIT_FAILURE; case PT_INIT_SUCCESS: emscripten_log(EM_LOG_CONSOLE, "Initailization succeded"); break; } emscripten_set_main_loop(pt_app_main_loop, 0, false); return EXIT_SUCCESS; }
// callback from javascript. void on_fatal(const char* msg, const char* error) { #ifdef __EMSCRIPTEN_TRACING__ emscripten_log(EM_LOG_CONSOLE, "Fatal Error: Closing trace!"); emscripten_trace_close(); #endif // !!JM todo: pass msg & error to a crash context? Must be copied? if (GHTML5CrashHandler) { FGenericCrashContext Ctx; GHTML5CrashHandler(Ctx); } }
void * open_decoder(void) { ISVCDecoder* decoder_ = NULL; if ( WelsCreateDecoder (&decoder_) ) { emscripten_log(EM_LOG_CONSOLE, "Create Decoder failed\n"); return NULL; } if (! decoder_) { emscripten_log(EM_LOG_CONSOLE, "Create Decoder failed (no handle)\n"); return NULL; } WelsTraceCallback cb = openh264_log; int32_t tracelevel = 3;//0x7fffffff; if ( decoder_->SetOption(DECODER_OPTION_TRACE_CALLBACK, (void*)&cb) ) { emscripten_log(EM_LOG_CONSOLE, "SetOption failed\n"); } if ( decoder_->SetOption(DECODER_OPTION_TRACE_LEVEL, &tracelevel) ) { emscripten_log(EM_LOG_CONSOLE, "SetOption failed\n"); } SDecodingParam decParam; memset (&decParam, 0, sizeof (SDecodingParam)); decParam.eOutputColorFormat = videoFormatI420; decParam.uiTargetDqLayer = UCHAR_MAX; decParam.eEcActiveIdc = ERROR_CON_SLICE_COPY; decParam.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT; if ( decoder_->Initialize (&decParam) ) { emscripten_log(EM_LOG_CONSOLE, "initialize failed\n"); return NULL; } return decoder_; }
bool FHTTPTransport::Initialize(const TCHAR* InHostIp) { // parse out the format FString HostIp = InHostIp; // make sure that we have the correct protcol ensure( HostIp.RemoveFromStart("http://") ); // check if we have specified the port also if ( HostIp.Contains(":") == false) { // no port put the default one on HostIp = FString::Printf(TEXT("%s:%d"), *HostIp, (int)(DEFAULT_HTTP_FILE_SERVING_PORT) ); } // make sure that our string is again correctly formated HostIp = FString::Printf(TEXT("http://%s"),*HostIp); FCString::Sprintf(Url, *HostIp); #if !PLATFORM_HTML5 HttpRequest = FHttpModule::Get().CreateRequest(); HttpRequest->SetURL(Url); #endif #if PLATFORM_HTML5_WIN32 HTML5Win32::NFSHttp::Init(TCHAR_TO_ANSI(Url)); #endif #if PLATFORM_HTML5_BROWSER emscripten_log(EM_LOG_CONSOLE , "Unreal File Server URL : %s ", TCHAR_TO_ANSI(Url)); #endif TArray<uint8> In,Out; bool RetResult = SendPayloadAndReceiveResponse(In,Out); return RetResult; }
void openh264_log(void * ctx, int level, const char * msg) { emscripten_log(EM_LOG_CONSOLE, "openh264 trace %d %s\n", level, msg); }
void say_hello() { emscripten_log(EM_LOG_CONSOLE, "say_hello"); }