Types
Every type exported from @warlock.js/logger.
LogLevel
Section titled “LogLevel”The five severity levels.
type LogLevel = "debug" | "info" | "warn" | "error" | "success";success ranks the same as info — it’s informational, not a warning. Ranking for minLevel: debug < info ≈ success < warn < error.
LoggingData
Section titled “LoggingData”The entry passed through log.log(...) and to every channel’s log().
type LoggingData = { type: "info" | "debug" | "warn" | "error" | "success"; module: string; action: string; message: any; context?: Record<string, any>;};OmittedLoggingData
Section titled “OmittedLoggingData”LoggingData without type — the object form accepted by the per-level shortcuts (log.info({...})), where the level is implied by the method.
type OmittedLoggingData = Omit<LoggingData, "type">;LogMessage
Section titled “LogMessage”The serialized shape stored by the file channels (one per buffered entry).
type LogMessage = { content: string; level: LogLevel; date: string; module: string; action: string; stack?: string; context?: Record<string, any>; timestamp?: string;};LogContract
Section titled “LogContract”The interface a channel must satisfy. LogChannel already implements it.
interface LogContract { name: string; description?: string; terminal?: boolean; log(data: LoggingData): void | Promise<void>; flushSync?(): void;}BasicLogConfigurations
Section titled “BasicLogConfigurations”The shared options every built-in channel config extends.
type BasicLogConfigurations = { /** Restrict which levels this channel handles. Omit for all levels. */ levels?: LogLevel[]; /** Day.js format strings for the date/time in each entry. */ dateFormat?: { date?: string; time?: string; }; /** Predicate to decide whether an entry should be logged. */ filter?: (data: LoggingData) => boolean; /** Add extra context to the entry. */ context?: (data: LoggingData) => Promise<Record<string, any>>; /** Channel-specific redaction — additive on top of the logger-wide floor. */ redact?: RedactConfig;};AutoFlushEvent
Section titled “AutoFlushEvent”The process events enableAutoFlush() can hook.
type AutoFlushEvent = | "SIGINT" | "SIGTERM" | "SIGHUP" | "SIGBREAK" | "SIGUSR2" | "beforeExit";Signals are flushed then re-raised so Node’s default exit runs; beforeExit is flushed in place. See Shutdown & flushing.
RedactConfig
Section titled “RedactConfig”type RedactConfig = { /** Dotted glob path patterns to redact, evaluated against LoggingData. */ paths: string[]; /** Replacement applied at each match. @default "[REDACTED]" */ censor?: RedactCensor;};RedactCensor
Section titled “RedactCensor”type RedactCensor = | string | ((value: any, path: string) => any);A literal string replaces every match; a function receives the original value plus the dotted path and returns the replacement. See Redaction.
DebugMode
Section titled “DebugMode”type DebugMode = "daily" | "monthly" | "yearly" | "hourly";