0.1.3 • Published 2 years ago

@llllvvuu/kvconsole v0.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

kvconsole.log

kvconsole.log is like console.log but for in-place updating values (separate from clutter from test runners and HMR). Right now it only works over HTTP (most stateless client), not sockets or filesystem.

https://github.com/llllvvuu/kvconsole.log/assets/5601392/f2ea22af-90f2-485f-99ee-33436fba52a8

Usage

pnpm install --dev @llllvvuu/kvconsole

Start the console program:

pnpm kvconsole # --help

Log to it (I've only written JavaScript/TypeScript logger for now, since HMR is really good in that ecosystem):

import { kvconsole } from "@llllvvuu/kvconsole"
// const kvconsole = require("@llllvvuu/kvconsole").kvconsole

kvconsole.log("hello", "world")
kvconsole.log("foo", "bar")

The console will look like:

(Press z to clear)
hello: world
foo: bar

If you update the file to

kvconsole.log("two", "hard problems")
kvconsole.log("foo", "baz")
kvconsole.log("hello", "again")

the console will look like:

(Press z to clear)
hello: world
foo: bar
two: hard problems

This should happen automatically if you're running in HMR mode such as vite-node or vitest.

Options

kvconsole CLI: -p/--port, -h/--host

kvconsole JavaScript/Typescript library:

import { makeKvconsole } from "@llllvvuu/kvconsole"

const kvconsole = makeKvconsole(opts /* : Opts */)

interface Opts {
  host?: string
  port?: number
  silent?: boolean
}
0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago