npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

console-fmt-cli

v2.9.1

Published

Pretty console logger for Node.js CLI apps and services

Readme

console-fmt-cli

Elegant, colorized console logging for Node.js — with optional decimal-format-core formatters for prediction-market and trading bots.

Version 2.9.0 is the recommended latest release: everything from 2.8.x plus re-exported stake and currency helpers so bot repos can depend on a single package.

npm install console-fmt-cli

Install

npm install console-fmt-cli
# peer (optional but recommended for trading bots):
npm install decimal-format-core

Node.js 14+. decimal-format-core is loaded as a peer-style optional dependency — if missing, logger functions still work; formatters throw a clear require error.


Quick start

const { createLogger } = require('console-fmt-cli');

const log = createLogger('polymarket-bot', {
  level: process.env.LOG_LEVEL || 'info',
  timestamps: true,
  child: true,
  time: true,
});

const strategy = log.child('strategy');
strategy.info('started');

Trading / stake formatting (2.9.0)

Re-exports from decimal-format-core:

const {
  createLogger,
  computeBoundedFraction,
  computeKellyStake,   // alias
  formatCurrency,
  formatStakeUsd,      // alias
  roundDecimal,
  roundStake,          // alias
} = require('console-fmt-cli');

const log = createLogger('stake', { timestamps: true });

const stake = computeKellyStake({
  probability: 0.58,
  allInPrice: 0.52,
  bankroll: 2000,
  maxStake: 100,
  scaleFactor: 0.5,
});

log.info(`size $${formatStakeUsd(stake)} (${roundStake(stake)} raw)`);

Logger API

createLogger(name, options?)

| Option | Default | Description | |--------|---------|-------------| | level | 'info' | Minimum level | | timestamps | false | ISO-8601 prefix | | color | true | ANSI colors | | prefix | true | [name] tag | | json | false | Adds log.json(obj) | | child | false | Adds log.child(sub) | | time | false | Adds log.time(label) |

Methods

log.debug(...args);
log.info(...args);
log.warn(...args);
log.error(...args);
log.json({ structured: true });     // when json: true
log.child('module');                // when child: true
const end = log.time('operation');  // when time: true
end();

Recommended bot log.js wrapper

const { createLogger } = require('console-fmt-cli');

let root;

function getLogger(module) {
  if (!root) {
    root = createLogger('bot', {
      level: process.env.LOG_LEVEL || 'info',
      timestamps: true,
      child: true,
      time: process.env.LOG_TIME === '1',
      color: process.stdout.isTTY,
    });
  }
  return module ? root.child(module) : root;
}

module.exports = { getLogger };

Why one dependency?

Trading templates previously imported:

  • a CLI logger
  • a stake math package
  • duplicate rounding helpers

2.9.0 consolidates the common path: console-fmt-cli + optional decimal-format-core matches what open Polymarket bot scaffolds expect.


Version history

| Version | Highlights | |---------|------------| | 2.0.0 | Initial logger | | 2.2.0 | JSON lines | | 2.3.0 | Child loggers | | 2.8.0 | Timers | | 2.9.0 | decimal-format-core formatters, npm latest |


FAQ

Must I install decimal-format-core?
Only if you use formatCurrency, computeKellyStake, etc. Logging alone does not require it.

Pino / Winston?
Use this for developer-facing CLI output; pipe JSON logs from log.json() into your collector if needed.


License

MIT