@@ -72,7 +72,7 @@ void Console::sendToDevToolsFrontEnd(v8::Isolate* isolate, const std::string& me
72
72
v8_inspector::V8LogAgentImpl::EntryAdded (message, logLevel, ArgConverter::ConvertToString (frame->GetScriptNameOrSourceURL ()), frame->GetLineNumber ());
73
73
}
74
74
75
- const std::string buildLogString (const v8::FunctionCallbackInfo<v8::Value>& info) {
75
+ const std::string buildLogString (const v8::FunctionCallbackInfo<v8::Value>& info, int startingIndex = 0 ) {
76
76
auto isolate = info.GetIsolate ();
77
77
78
78
v8::HandleScope scope (isolate);
@@ -81,7 +81,7 @@ const std::string buildLogString(const v8::FunctionCallbackInfo<v8::Value>& info
81
81
82
82
auto argLen = info.Length ();
83
83
if (argLen) {
84
- for (int i = 0 ; i < argLen; i++) {
84
+ for (int i = startingIndex ; i < argLen; i++) {
85
85
v8::Local<v8::String> argString;
86
86
if (info[i]->IsFunction ()) {
87
87
info[i]->ToDetailString (isolate->GetCurrentContext ()).ToLocal (&argString);
@@ -120,10 +120,7 @@ void Console::assertCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
120
120
assertionError << " Assertion failed: " ;
121
121
122
122
if (argLen > 1 ) {
123
- v8::Local<v8::String> argString;
124
- info[1 ]->ToDetailString (isolate->GetCurrentContext ()).ToLocal (&argString);
125
-
126
- assertionError << ArgConverter::ConvertToString (argString);
123
+ assertionError << buildLogString (info, 1 );
127
124
} else {
128
125
assertionError << " console.assert" ;
129
126
}
@@ -197,11 +194,12 @@ void Console::dirCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
197
194
198
195
ss << " ==== object dump end ====" << std::endl;
199
196
} else {
200
- v8::Local<v8::String> argString;
201
- info[0 ]->ToString (isolate->GetCurrentContext ()).ToLocal (&argString);
197
+ std::string logString = buildLogString (info);
202
198
203
- ss << ArgConverter::ConvertToString (argString) ;
199
+ ss << logString ;
204
200
}
201
+ } else {
202
+ ss << std::endl;
205
203
}
206
204
207
205
std::string log = ss.str ();
0 commit comments