MCPcopy Create free account
hub / github.com/NativeScript/android / traceCallback

Method traceCallback

test-app/runtime/src/main/cpp/console/Console.cpp:401–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399}
400
401void Console::traceCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
402 try {
403 auto isolate = info.GetIsolate();
404 std::stringstream ss;
405
406 std::string logString = buildLogString(info);
407
408 if (logString.compare("\n") == 0) {
409 ss << "Trace";
410 } else {
411 ss << "Trace: " << logString;
412 }
413
414 ss << std::endl;
415
416 v8::HandleScope scope(isolate);
417
418 auto stack = v8::StackTrace::CurrentStackTrace(isolate, 10, v8::StackTrace::StackTraceOptions::kDetailed);
419
420 auto framesCount = stack->GetFrameCount();
421
422 for (int i = 0; i < framesCount; i++) {
423 auto frame = stack->GetFrame(isolate, i);
424
425 ss << buildStacktraceFrameMessage(frame) << std::endl;
426 }
427
428 std::string log = ss.str();
429 __android_log_write(ANDROID_LOG_ERROR, LOG_TAG, log.c_str());
430 sendToDevToolsFrontEnd(isolate, ConsoleAPIType::kTrace, info);
431 } catch (NativeScriptException& e) {
432 e.ReThrowToV8();
433 } catch (std::exception e) {
434 std::stringstream ss;
435 ss << "Error: c++ exception: " << e.what() << std::endl;
436 NativeScriptException nsEx(ss.str());
437 nsEx.ReThrowToV8();
438 } catch (...) {
439 NativeScriptException nsEx(std::string("Error: c++ exception!"));
440 nsEx.ReThrowToV8();
441 }
442}
443
444void Console::timeCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
445 try {

Callers

nothing calls this directly

Calls 7

buildLogStringFunction · 0.85
GetFrameMethod · 0.80
ReThrowToV8Method · 0.80
GetIsolateMethod · 0.45
compareMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected