Files
klz-cables.com/.pnpm-store/v10/files/7b/5b47059610bcfc8f5ec4cd2a0c57cd62057796df5dbcb03689379d6a619f8cee89b76007c2ecba8d9ac63bb85358413905f59214b63007bd06d6aa9e2e6d4c
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

42 lines
1.2 KiB
Plaintext

'use strict'
module.exports = prettifyLevel
const getPropertyValue = require('./get-property-value')
/**
* @typedef {object} PrettifyLevelParams
* @property {object} log The log object.
* @property {PrettyContext} context The context object built from parsing
* the options.
*/
/**
* Checks if the passed in log has a `level` value and returns a prettified
* string for that level if so.
*
* @param {PrettifyLevelParams} input
*
* @returns {undefined|string} If `log` does not have a `level` property then
* `undefined` will be returned. Otherwise, a string from the specified
* `colorizer` is returned.
*/
function prettifyLevel ({ log, context }) {
const {
colorizer,
customLevels,
customLevelNames,
levelKey,
getLevelLabelData
} = context
const prettifier = context.customPrettifiers?.level
const output = getPropertyValue(log, levelKey)
if (output === undefined) return undefined
const labelColorized = colorizer(output, { customLevels, customLevelNames })
if (prettifier) {
const [label] = getLevelLabelData(output)
return prettifier(output, levelKey, log, { label, labelColorized, colors: colorizer.colors })
}
return labelColorized
}