Style
/ API Reference / Plugins
Style
/ API Reference / Plugins

logger

This plugin logs style objects to the console for debugging purposes.

The Gist

import { loggerPlugin } from '@weser/style'

const plugin = loggerPlugin({
  prefix: '[Style]',
  stringify: false,
  clone: true,
})

Parameters

ParameterTypeDefaultDescription
configConfig?{}Configuration options for the logger.

Config

PropertyTypeDefaultDescription
prefixstring?''A prefix string to prepend to each log message.
stringifyboolean?falseWhether to stringify the style object using JSON.stringify.
cloneboolean?trueWhether to clone the style object before logging (to avoid mutations).

Returns

(Plugin) A plugin function that can be passed to the createRenderer function.

On this page