CI / Docker image (push) Successful in 12s
CI / Server (push) Successful in 25s
CI / CLI (push) Successful in 13s
Development image / Development image (push) Successful in 21s
CI / CLI (windows) (push) Successful in 57s
CI / CLI (linux-arm64, static) (push) Successful in 1m37s
Release / Prepare release (push) Successful in 2s
Release / Server (linux-x64) (push) Successful in 53s
Release / CLI (linux-arm64, static) (push) Successful in 1m32s
Release / Docker image (push) Successful in 2m48s
Release / Server (windows-x64) (push) Successful in 6m20s
Release / CLI (windows-x64) (push) Successful in 6m48s
Release / CLI (linux-x64) (push) Successful in 7m8s
Release / Publish release (push) Successful in 1s
Squash the tree into one commit, drop docs/architecture.html, reset the version line to 0.3.0, consolidate the changelog, enable Renovate automerge for non-major updates and add AGENTS.md.
25 lines
1.0 KiB
JavaScript
25 lines
1.0 KiB
JavaScript
const LEVELS = { error: 0, warn: 1, info: 2, debug: 3 };
|
|
const COLORS = { error: "\x1b[31m", warn: "\x1b[33m", info: "\x1b[32m", debug: "\x1b[35m" };
|
|
const RESET = "\x1b[0m";
|
|
|
|
const level = LEVELS[process.env.LOG_LEVEL] ?? LEVELS.info;
|
|
const useColor = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
|
|
const log = (lvl, message, meta) => {
|
|
if (LEVELS[lvl] > level) return;
|
|
const time = new Date().toISOString();
|
|
const tag = useColor ? `${COLORS[lvl]}${lvl.padEnd(5)}${RESET}` : lvl.padEnd(5);
|
|
const extra = meta && Object.keys(meta).length
|
|
? " " + Object.entries(meta).map(([k, v]) => `${k}=${typeof v === "object" ? JSON.stringify(v) : v}`).join(" ")
|
|
: "";
|
|
const line = `${time} ${tag} ${message}${extra}`;
|
|
(lvl === "error" || lvl === "warn" ? console.error : console.log)(line);
|
|
};
|
|
|
|
module.exports = {
|
|
error: (m, meta) => log("error", m, meta),
|
|
warn: (m, meta) => log("warn", m, meta),
|
|
info: (m, meta) => log("info", m, meta),
|
|
debug: (m, meta) => log("debug", m, meta),
|
|
};
|