MCPcopy Create free account
hub / github.com/crownengine/crown / stdout_log

Function stdout_log

src/device/log.cpp:25–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23 static Mutex s_mutex;
24
25 static void stdout_log(LogSeverity::Enum sev, System system, const char *format)
26 {
27 char buf[8192];
28#if CROWN_PLATFORM_POSIX && !CROWN_PLATFORM_ANDROID && !CROWN_PLATFORM_EMSCRIPTEN
29 #define ANSI_RESET "\x1b[0m"
30 #define ANSI_YELLOW "\x1b[33m"
31 #define ANSI_RED "\x1b[31m"
32
33 const char *stt[] = { ANSI_RESET, ANSI_YELLOW, ANSI_RED, ANSI_RESET };
34 CE_STATIC_ASSERT(countof(stt) == LogSeverity::COUNT);
35
36 stbsp_snprintf(buf, sizeof(buf), "%s%s: %s\n" ANSI_RESET, stt[sev], system.name, format);
37#else
38 stbsp_snprintf(buf, sizeof(buf), "%s: %s\n", system.name, format);
39#endif
40 os::log(buf);
41 }
42
43 /// Sends a log message to all clients.
44 static void console_log(LogSeverity::Enum sev, System system, const char *msg)

Callers 1

vlogxFunction · 0.85

Calls 1

logFunction · 0.50

Tested by

no test coverage detected