Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/jsc/JavaScriptUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,20 @@ static JSValueRef consoleCallbackImpl(JSContextRef ctx, size_t argumentCount,

InspectorHTTPServer::singleton().sendConsoleMessage(ctx, level, oss.str().c_str());
#endif
NativeJSLogger::log(INFO, "%s", oss.str().c_str());
const std::string fullMsg = oss.str();
constexpr size_t kMaxLogChunk = 900; // keep under device/syslog line limits

if (fullMsg.size() <= kMaxLogChunk) {
NativeJSLogger::log(INFO, "%s", fullMsg.c_str());
} else {
const size_t total = (fullMsg.size() + kMaxLogChunk - 1) / kMaxLogChunk;
for (size_t i = 0; i < total; ++i) {
const size_t start = i * kMaxLogChunk;
const size_t len = std::min(kMaxLogChunk, fullMsg.size() - start);
const std::string chunk = fullMsg.substr(start, len);
NativeJSLogger::log(INFO, "[%zu/%zu] %s", i + 1, total, chunk.c_str());
}
}
return JSValueMakeUndefined(ctx);
}

Expand Down