diff --git a/lib/messageFormatFactory.js b/lib/messageFormatFactory.js index 441fb56..1583c69 100644 --- a/lib/messageFormatFactory.js +++ b/lib/messageFormatFactory.js @@ -3,13 +3,13 @@ const formatDate = require('./formatDate') const colorizerFactory = require('pino-pretty').colorizerFactory const messageFormatFactory = (levels, colors, useColors) => { - const customColors = - colors != null - ? Object.entries(colors).reduce((colors, [level, color]) => { - colors.push([level, color]) - return colors - }, []) - : undefined + let customColors + if (colors !== null) { + customColors = [] + for (const entry of Object.entries(colors)) { + customColors.push(entry) + } + } const colorizer = colorizerFactory(useColors, customColors) const levelLookUp = {