MCPcopy Create free account
hub / github.com/Tencent/MMKV / internalLogWithLevel

Function internalLogWithLevel

Android/MMKV/mmkv/src/main/cpp/native-bridge.cpp:306–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306extern "C" void internalLogWithLevel(MMKVLogLevel level, const char *filename, const char *func, int line, const char *format, ...) {
307 if (level >= g_currentLogLevel) {
308 std::string message;
309 char buffer[16];
310
311 va_list args;
312 va_start(args, format);
313 auto length = std::vsnprintf(buffer, sizeof(buffer), format, args);
314 va_end(args);
315
316 if (length < 0) { // something wrong
317 message = {};
318 } else if (length < sizeof(buffer)) {
319 message = std::string(buffer, static_cast<unsigned long>(length));
320 } else {
321 message.resize(static_cast<unsigned long>(length), '\0');
322 va_start(args, format);
323 std::vsnprintf(const_cast<char *>(message.data()), static_cast<size_t>(length) + 1, format, args);
324 va_end(args);
325 }
326
327 if (g_cls && g_mmkvLogID) {
328 mmkvLog(level, filename, line, func, message);
329 } else {
330 _MMKVLogWithLevel(level, filename, func, line, message.c_str());
331 }
332 }
333}
334
335static void mmkvLog(MMKVLogLevel level, const char *file, int line, const char *function, const std::string &message) {
336 auto currentEnv = getCurrentEnv();

Callers

nothing calls this directly

Calls 2

mmkvLogFunction · 0.70
_MMKVLogWithLevelFunction · 0.50

Tested by

no test coverage detected