Skip to content

About this page

On this page

Logging ​

Every toolchain message goes through one logger. Configure it in the config:

dbx.config.ts
ts
export default defineConfig({
    toolchain: {
        logger: { level: 'debug', color: false, name: 'dbx' },
    },
});
OptionValuesDefault
leveldebug | info | warn | error | silentinfo
colortrue | falsetrue
nameprefix for non-indented linesdbx
suppressid, message substring or /regex/ (single/array)none
loggercustom ToolchainLogger implementationnone

suppress silences matching warnings/errors. A string matches an emitted id exactly or a message substring; a /pattern/flags string is treated as a regex. Ids are rendered in uppercase in the output (eg. [FMT_CONFLICT]), but match the lowercase id when suppressing. It accepts one value or an array:

dbx.config.ts
ts
toolchain: {
    logger: {
        suppress: ['fmt.conflict', 'deprecated option', '/^Could not .* globally/'],
    },
}

Colour is on by default (the toolchain forces it rather than relying on TTY autodetection); --no-color or logger: { color: false } turn it off. Human output is rendered with @clack/prompts — level symbols (• info, ◆ success, ▲ warn, ■ error) and a guide.

Custom logger ​

Pass any object implementing the agnostic ToolchainLogger interface (raw, rawError, write, debug, info, success, warn, error) to logger.logger. Level/suppression checks still apply before your methods run.

dbx.config.ts
ts
const custom = {
    raw: (message = '') => process.stdout.write(`${message}\n`),
    rawError: (message = '') => process.stderr.write(`${message}\n`),
    write: () => {},
    debug: () => {},
    info: (message = '') => mySink.info(message),
    success: (message = '') => mySink.info(message),
    warn: (message = '') => mySink.warn(message),
    error: (message = '') => mySink.error(message),
};

export default defineConfig({
    toolchain: { logger: { logger: custom } },
});

On the CLI, --log-level <level> and --no-color override the config (see the CLI reference). Machine output (--json) is written unprefixed through the same logger.