Console Channel
ConsoleLog writes colorized, icon-prefixed lines to the terminal. No external dependencies, no configuration required to start.
import { ConsoleLog } from "@warlock.js/logger";
const channel = new ConsoleLog();It sets terminal: true, so ANSI color codes in your messages are preserved (unlike the file channels, which strip them).
Terminal output
Section titled “Terminal output”Each line follows this format:
{icon} {level} ({time}) [{module}] [{action}] {message}The console shows a time-only timestamp (HH:mm:ss.SSS) — within a dev session the date rarely changes, so the full ISO date is dropped here. The persistent channels (FileLog / JSONFileLog) keep the full ISO timestamp.
Real output:
⚙ debug (10:22:00.000) [auth] [hashPassword] Hashing startedℹ info (10:22:01.482) [users] [register] New user created⚠ warn (10:22:02.300) [queue] [process] Retry limit approaching✗ error (10:22:03.111) [payments] [charge] Card declined✓ success (10:22:03.890) [email] [send] Welcome email deliveredPrefix by level — each line is prefixed with the level’s icon and name. The name is padded to a fixed width so the timestamp, module, and action columns line up vertically across a stream of logs:
| Level | Prefix |
|---|---|
debug | ⚙ debug |
info | ℹ info |
warn | ⚠ warn |
error | ✗ error |
success | ✓ success |
fatal | ☠ fatal — white on a bright-red background badge (deliberately louder than error so a fatal entry can’t be missed) |
Colors by part
| Part | Color |
|---|---|
Timestamp (…) | Gray (dimmed, so the message stands out) |
Module […] | Cyan |
Action […] | Magenta |
Message — debug | Magenta bright |
Message — info | Blue bright |
Message — warn | Yellow bright |
Message — error | Red bright |
Message — success | Green bright |
Message — fatal | Red bright + bold |
Showing context
Section titled “Showing context”By default ConsoleLog discards the context payload — the file/JSON channels still record it, but the terminal stays uncluttered. Set showContext: true to render the context object on a second line, pretty-printed with util.inspect:
import { ConsoleLog, log } from "@warlock.js/logger";
log.addChannel(new ConsoleLog({ showContext: true }));
log.info("payments", "charge", "card declined", { userId: 42, amount: 1999,});// ℹ info (…) [payments] [charge] card declined// ↳ { userId: 42, amount: 1999 }contextDepth (default 4) clamps how deep util.inspect recurses into nested objects — useful when one context field is a giant payload you don’t want sprawling across the terminal:
new ConsoleLog({ showContext: true, contextDepth: 1, // collapses nested objects to [Object]});Minimum level — minLevel
Section titled “Minimum level — minLevel”minLevel drops every entry below a severity on this channel only (debug < info = success < warn < error < fatal). Other channels still receive those entries. It is not set by default, so every level is printed.
import { ConsoleLog, FileLog, log } from "@warlock.js/logger";
log.configure({ channels: [ new ConsoleLog({ minLevel: "info" }), // no debug lines on the terminal new FileLog(), // the file still records debug entries ],});minLevel combines with levels: an entry must pass both. When no channel keeps a level, log.isEnabled(level) returns false and the logger skips the entry before redaction, so a debug line costs almost nothing in production.
Terminal escapes in messages
Section titled “Terminal escapes in messages”Colour codes in a message are kept (the framework colours parts of its own messages), but every other terminal escape sequence is removed before printing: cursor movement, screen clearing, window titles, clipboard writes and the “conceal” style. Other control characters are shown as \uXXXX. Text taken from a request can therefore not rewrite or hide what the terminal shows. Line breaks are printed as they are.
Filtering
Section titled “Filtering”ConsoleLog accepts the shared levels array and filter predicate (see Channels Overview). A common pattern is keeping the terminal focused on the subsystem you’re working on:
import { ConsoleLog } from "@warlock.js/logger";
// Only show auth-related messages during local developmentnew ConsoleLog({ filter: (data) => data.module === "auth",});
// Show everything except background workersnew ConsoleLog({ filter: (data) => !["queue", "scheduler"].includes(data.module),});
// Errors always pass through, info only for paymentsnew ConsoleLog({ filter: (data) => data.type === "error" || data.module === "payments",});The full option shape is ConsoleLogConfig — the shared options plus showContext / contextDepth / minLevel.