MCPcopy Create free account
hub / github.com/defold/defold / DoLogPlatform

Function DoLogPlatform

engine/dlib/src/dlib/log.cpp:298–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296#endif
297
298static void DoLogPlatform(LogSeverity severity, const char* output, int output_len)
299{
300#ifdef ANDROID
301 __android_log_print(dmLog::ToAndroidPriority(severity), "defold", "%s", output);
302
303// iOS
304#elif TARGET_OS_IOS==1
305 dmLog::__ios_log_print(severity, output);
306#endif
307
308#ifdef __EMSCRIPTEN__
309
310 //Emscripten maps stderr to console.error and stdout to console.log.
311 if (severity == LOG_SEVERITY_ERROR || severity == LOG_SEVERITY_FATAL)
312 {
313 EM_ASM_({
314 Module.printErr(UTF8ToString($0));
315 }, output);
316 } else {
317 EM_ASM_({
318 Module.print(UTF8ToString($0));
319 }, output);
320 }
321#elif defined(_GAMING_XBOX)
322 OutputDebugStringA(output);
323#else
324 if (severity == LOG_SEVERITY_ERROR || severity == LOG_SEVERITY_FATAL)
325 {
326 fwrite(output, 1, output_len, stderr);
327 }
328 else
329 {
330 fwrite(output, 1, output_len, stdout);
331 }
332#endif
333}
334
335// Here we put logging that needs to be thread safe
336// We either push it on the logger thread, or from the main thread if threads aren't supported (e.g. html5)

Callers 1

LogInternalFunction · 0.85

Calls 2

ToAndroidPriorityFunction · 0.85
printMethod · 0.45

Tested by

no test coverage detected