We will be sunsetting Advisor during Jan, 2026 and will instead be providing information in Snyk Security DB.

You can begin to take advantage of Snyk Security DB today for a unified, package-centric experience.

How to use the @nimiq/core.Log.w function in @nimiq/core

To help you get started, we’ve selected a few @nimiq/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github skypool-org / skypool-nimiq-miner / index.js View on Github external
argv.server = argvCmd.server || argv.server;
    argv.cpu = argvCmd.cpu || argv.cpu;

    console.log(argv);

    if (!argv.address) {
        await logWithoutExit('Usage: node index.js --address=<address> [--name=] [--thread=] [--server=] [--percent=] [--cpu=]');
    }

    const address = argv.address;

    let name = argv.name || '*';
    // auto set name
    if (name === '*') {
        name = [ip.address(), os.platform(), os.arch(), os.release()].join(' ');
        Log.w(`auto set name to ${name}`)
    }

    let thread = parseInt(argv.thread);
    const max_thread = os.cpus().length;
    if (thread &gt; max_thread) {
        Log.w(`thread ${thread} larger than CPU threads ${max_thread}, force thread to ${max_thread}`);
        thread = max_thread;
    }
    if (thread === 0 || !Number.isInteger(thread)) {
        thread = max_thread &gt; 1 ? max_thread - 1 : 1;
        Log.w(`auto set thread to ${thread}`);
    }
    if (thread &lt; 0) {
        thread = max_thread;
        Log.w(`auto set thread to ${thread}`);
    }</address>
github skypool-org / skypool-nimiq-miner / index.js View on Github external
switchInedx = 0;
        }
        server = argv.server[switchInedx];
        Log.w(`switch to server ${server}`);
    } else {
        server = argv.server;
    }


    const percent = parseFloat(argv.percent || 100);
    const event = new EventEmitter();

    // choose cpu version
    let cpu;
    if (argv.cpu &amp;&amp; CPUType[argv.cpu]) {
        Log.w('CPU type given by user, choose ' + argv.cpu + ' version.');
        cpu = CPUType[argv.cpu];
    } else {
        cpu = await autoDetectCPU();
    }

    if (thread &gt; 128) {
        logWithoutExit('Error: thread too large');
    } else if (thread &lt;= 0) {
        logWithoutExit('Error: thread too small');
    } else if (address &amp;&amp; address.length !== 44) {
        logWithoutExit('Error: address format error');
    } else if (name &amp;&amp; name.length &gt; 200) {
        logWithoutExit('Error: name too long');
    } else if (percent &lt; 50 || percent &gt; 100) {
        logWithoutExit('Error: percent need between 50 to 100');
    } else {
github skypool-org / skypool-nimiq-miner / index.js View on Github external
let name = argv.name || '*';
    // auto set name
    if (name === '*') {
        name = [ip.address(), os.platform(), os.arch(), os.release()].join(' ');
        Log.w(`auto set name to ${name}`)
    }

    let thread = parseInt(argv.thread);
    const max_thread = os.cpus().length;
    if (thread &gt; max_thread) {
        Log.w(`thread ${thread} larger than CPU threads ${max_thread}, force thread to ${max_thread}`);
        thread = max_thread;
    }
    if (thread === 0 || !Number.isInteger(thread)) {
        thread = max_thread &gt; 1 ? max_thread - 1 : 1;
        Log.w(`auto set thread to ${thread}`);
    }
    if (thread &lt; 0) {
        thread = max_thread;
        Log.w(`auto set thread to ${thread}`);
    }

    // switch server
    let server;
    if (typeof argv.server === 'object') {
        if (switchInedx &gt;= argv.server.length) {
            switchInedx = 0;
        }
        server = argv.server[switchInedx];
        Log.w(`switch to server ${server}`);
    } else {
        server = argv.server;
github skypool-org / skypool-nimiq-miner / index.js View on Github external
autoRestartInterval = setInterval(() =&gt; {
    if (miner &amp;&amp; miner._hashrateValue &lt;= 0.01) {
        Log.w('Hashrate is zero');
        zeroHashCount++;
    } else {
        zeroHashCount = 0;
    }
    if (zeroHashCount &gt;= 3) {
        Log.w('Restart beacuse of zero hashrate');
        zeroHashCount = 0;
        miner.delete();
        switchInedx += 1;
        main();
    }
}, 20000);
github skypool-org / skypool-nimiq-miner / index.js View on Github external
autoRestartInterval = setInterval(() =&gt; {
    if (miner &amp;&amp; miner._hashrateValue &lt;= 0.01) {
        Log.w('Hashrate is zero');
        zeroHashCount++;
    } else {
        zeroHashCount = 0;
    }
    if (zeroHashCount &gt;= 3) {
        Log.w('Restart beacuse of zero hashrate');
        zeroHashCount = 0;
        miner.delete();
        switchInedx += 1;
        main();
    }
}, 20000);