scripts/net-monitor.js
/**
 * Duplicate a log of a running script into the box.
 * @param {string} subsystem
 * @param {Element} box
 * @param {NS} ns
 */
Duplicate a log of a running script into the box.
Duplicate a log of a running script into the box .
function printLogMessages(subsystem, box, ns) {
    ns.print('Finding log messages for subsystem: ' + subsystem);
    let sys = subsystems.find((s) => s.name === subsystem);
    if (!sys) return;
    sys.refreshStatus(ns);
    let output = ns.getScriptLogs(sys.filename, sys.host, ...sys.process.args);
    let htmlFormat = (s) => {
        if (s === '') return '</br>';
        return `<p>${s}</p>`;
    };
    let monitorElem = box.querySelector('.panopticon-log');
    monitorElem.innerHTML = output
        .slice(-4)
        .map((line) => htmlFormat(line))
        .join('');
}
function printLogMessages ( subsystem , box , ns ) { ns . print ( 'Finding log messages for subsystem: ' + subsystem ) ; let sys = subsystems . find ( ( s ) => s . name === subsystem ) ; if ( ! sys ) return ; sys . refreshStatus ( ns ) ; let output = ns . getScriptLogs ( sys . filename , sys . host , ... sys . process . args ) ; let htmlFormat = ( s ) => { if ( s === '' ) return '</br>' ; return ` ${ s } ` ; } ; let monitorElem = box . querySelector ( '.panopticon-log' ) ; monitorElem . innerHTML = output . slice ( - 4 ) . map ( ( line ) => htmlFormat ( line ) ) . join ( '' ) ; }
Duplicate a log of a running script into the box.
Duplicate a log of a running script into the box .