RemoteDebug/remotedebug-ios-webkit-adapter

can not console fommating fix

inno76 opened this issue · 2 comments

Log.entryAdded event console fomatting not support

Attach the modified code that I use

out/protocols/ios/ios.js
src/protocols/ios/ios.ts

-- current code
// const consoleMessage = {
// source: message.source,
// level: type,
// text: message.text,
// lineNumber: message.line,
// timestamp: (new Date).getTime(),
// url: message.url,
// stackTrace: message.stackTrace ? {
// callFrames: message.stackTrace
// } : undefined,
// networkRequestId: message.networkRequestId,
// };

    // this._target.fireEventToTools('Log.entryAdded', {
    //     entry: consoleMessage
    // });

-- modify code
if(message.parameters) {
const consoleMessage = {
type: type,
args: message.parameters || [],
executionContextId: this._lastPageExecutionContextId,
timestamp: (new Date).getTime(),
stackTrace: message.stackTrace ? {
callFrames: message.stackTrace
} : undefined
};
this._target.fireEventToTools('Runtime.consoleAPICalled', consoleMessage);

    } else {
    const consoleMessage = {
        source: message.source,
        level: type,
        text: message.text,
        lineNumber: message.line,
        timestamp: (new Date).getTime(),
        url: message.url,
        stackTrace: message.stackTrace ? {
            callFrames: message.stackTrace
        } : undefined,
        networkRequestId: message.networkRequestId,
    };
    this._target.fireEventToTools('Log.entryAdded', {
        entry: consoleMessage
    });
    }

If you could open a PR for this, it would be much appreciated.

This project is now super-seeded by https://inspect.dev/ – a new developer tool for macOS and Windows to inspect and debug your web apps and websites in Safari and WebViews on iOS devices.

RemoteDebug iOS WebKit Adapter is not proactively maintained or extended.