| 20 | namespace tns { |
| 21 | |
| 22 | v8::Local<v8::Object> Console::createConsole(v8::Local<v8::Context> context, ConsoleCallback callback, const int maxLogcatObjectSize, const bool forceLog) { |
| 23 | m_callback = callback; |
| 24 | m_maxLogcatObjectSize = maxLogcatObjectSize; |
| 25 | v8::Context::Scope contextScope(context); |
| 26 | v8::Isolate* isolate = context->GetIsolate(); |
| 27 | |
| 28 | v8::Local<v8::Object> console = v8::Object::New(isolate); |
| 29 | bool success = console->SetPrototype(context, v8::Object::New(isolate)).FromMaybe(false); |
| 30 | |
| 31 | assert(success); |
| 32 | |
| 33 | std::map<std::string, double> timersMap; |
| 34 | Console::s_isolateToConsoleTimersMap.insert(std::make_pair(context->GetIsolate(), timersMap)); |
| 35 | |
| 36 | bindFunctionProperty(context, console, "assert", assertCallback); |
| 37 | bindFunctionProperty(context, console, "error", errorCallback); |
| 38 | bindFunctionProperty(context, console, "info", infoCallback); |
| 39 | bindFunctionProperty(context, console, "log", logCallback); |
| 40 | bindFunctionProperty(context, console, "warn", warnCallback); |
| 41 | bindFunctionProperty(context, console, "dir", dirCallback); |
| 42 | bindFunctionProperty(context, console, "trace", traceCallback); |
| 43 | bindFunctionProperty(context, console, "time", timeCallback); |
| 44 | bindFunctionProperty(context, console, "timeEnd", timeEndCallback); |
| 45 | |
| 46 | return console; |
| 47 | } |
| 48 | |
| 49 | void Console::sendToADBLogcat(const std::string& message, android_LogPriority logPriority) { |
| 50 | // limit the size of the message that we send to logcat using the predefined value in package.json |
nothing calls this directly
no test coverage detected