Skip to content

Log & Divider

import { log } from "@arshad-shah/clif";
log.info("Server started on port 3000"); // ℹ Server started on port 3000
log.success("Build complete"); // ✔ Build complete
log.warn("Deprecation notice"); // ⚠ Deprecation notice
log.error("Connection refused"); // ✖ Connection refused
log.debug("Query took 12ms"); // ● Query took 12ms (only when DEBUG is set)
log.step(2, 5, "Compiling TypeScript..."); // [2/5] Compiling TypeScript...

info, success, and step write to stdout. warn, error, and debug write to stderr.

import { divider } from "@arshad-shah/clif";
console.log(divider());
// ────────────────────────────────────────────────────────────
console.log(divider({ label: "Configuration", width: 40 }));
// ──────────── Configuration ─────────────
console.log(divider({ char: "", width: 30 }));
// ══════════════════════════════
import { cyan } from "@arshad-shah/clif";
console.log(divider({ label: "Section", color: cyan }));
OptionTypeDefaultDescription
widthnumber60Total width in characters
charstringFill character
labelstringOptional centered label
colorFormatterdimColor applied to the fill (not the label)
import { banner, bold } from "@arshad-shah/clif";
console.log(banner("Deploy v2.0"));
// ══════════════════
// ═ Deploy v2.0 ═
// ══════════════════
console.log(banner("Release", { char: "#", color: bold }));
OptionTypeDefaultDescription
colorFormatterboldColor of the text
charstringBorder character
import { keyValue } from "@arshad-shah/clif";
console.log(
keyValue({
version: "2.1.0",
node: process.version,
platform: process.platform,
uptime: "3h 42m",
}),
);
// version 2.1.0
// node v22.22.2
// platform linux
// uptime 3h 42m
OptionTypeDefaultDescription
separatorstring" "Text placed between the key and value
keyColorFormatterdimColor applied to each key
valueColorFormatteridentityColor applied to each value
indentnumber0Leading spaces before each row