refactor: replace console.log with structured logger calls
Replace raw `console.log`/`console.error` calls across CLI, API handlers, and module files with structured logger functions (`step`, `done`, `warn`, `fail`) from the shared logger library. This improves log consistency, readability, and makes it easier to control output formatting and log levels from a single place.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* ZEN Console Logger
|
||||
* Centralized, styled logging for server-side output.
|
||||
* Inspired by the zen-start CLI style.
|
||||
*/
|
||||
|
||||
const c = {
|
||||
reset: '\x1b[0m',
|
||||
dim: '\x1b[2m',
|
||||
bold: '\x1b[1m',
|
||||
green: '\x1b[32m',
|
||||
yellow: '\x1b[33m',
|
||||
red: '\x1b[31m',
|
||||
cyan: '\x1b[36m',
|
||||
};
|
||||
|
||||
const out = (msg) => process.stdout.write(msg + '\n');
|
||||
|
||||
/** In-progress step — dim ◆ */
|
||||
export const step = (msg) => out(` ${c.dim}◆${c.reset} ${msg}`);
|
||||
/** Success — green ✓ */
|
||||
export const done = (msg) => out(` ${c.green}✓${c.reset} ${msg}`);
|
||||
/** Warning — yellow ⚠ */
|
||||
export const warn = (msg) => out(` ${c.yellow}⚠${c.reset} ${msg}`);
|
||||
/** Error / failure — red ✗ */
|
||||
export const fail = (msg) => out(` ${c.red}✗${c.reset} ${msg}`);
|
||||
/** Sub-item detail — dim · */
|
||||
export const info = (msg) => out(` ${c.dim}·${c.reset} ${msg}`);
|
||||
|
||||
export const logger = { step, done, warn, fail, info };
|
||||
Reference in New Issue
Block a user