Skip to content

Commit 9a10e2b

Browse files
committed
feat: add console message type prefixes
1 parent 81806b3 commit 9a10e2b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

test-app/runtime/src/main/cpp/console/Console.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ void Console::assertCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
187187

188188
void Console::errorCallback(const v8::FunctionCallbackInfo <v8::Value>& info) {
189189
try {
190-
std::string log = buildLogString(info);
190+
std::string log = "CONSOLE ERROR ";
191+
log += buildLogString(info);
191192

192193
sendToADBLogcat(log, ANDROID_LOG_ERROR);
193194
sendToDevToolsFrontEnd(info.GetIsolate(), log, "error");
@@ -206,7 +207,8 @@ void Console::errorCallback(const v8::FunctionCallbackInfo <v8::Value>& info) {
206207

207208
void Console::infoCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
208209
try {
209-
std::string log = buildLogString(info);
210+
std::string log = "CONSOLE INFO ";
211+
log += buildLogString(info);
210212

211213
sendToADBLogcat(log, ANDROID_LOG_INFO);
212214
sendToDevToolsFrontEnd(info.GetIsolate(), log, "info");
@@ -225,7 +227,8 @@ void Console::infoCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
225227

226228
void Console::logCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
227229
try {
228-
std::string log = buildLogString(info);
230+
std::string log = "CONSOLE LOG ";
231+
log += buildLogString(info);
229232

230233
sendToADBLogcat(log, ANDROID_LOG_INFO);
231234
sendToDevToolsFrontEnd(info.GetIsolate(), log, "info");
@@ -244,7 +247,8 @@ void Console::logCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
244247

245248
void Console::warnCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
246249
try {
247-
std::string log = buildLogString(info);
250+
std::string log = "CONSOLE WARN ";
251+
log += buildLogString(info);
248252

249253
sendToADBLogcat(log, ANDROID_LOG_WARN);
250254
sendToDevToolsFrontEnd(info.GetIsolate(), log, "warning");
@@ -491,7 +495,7 @@ void Console::timeEndCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
491495
double diffMilliseconds = diffMicroseconds / 1000.0;
492496

493497
std::stringstream ss;
494-
ss << label << ": " << std::fixed << std::setprecision(3) << diffMilliseconds << "ms" ;
498+
ss << "CONSOLE TIME " << label << ": " << std::fixed << std::setprecision(3) << diffMilliseconds << "ms" ;
495499
std::string log = ss.str();
496500

497501
__android_log_write(ANDROID_LOG_INFO, LOG_TAG, log.c_str());

0 commit comments

Comments
 (0)