Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import format from '../format' export interface LabelOptions { /** * A label to be added before the message. */ label?: string /** * If set to `true` the `label` will be added to `info.message`. If set to `false` the `label` * will be added as `info.label`. */ message?: boolean } /* * function label (info) * Returns a new instance of the label Format which adds the specified * `opts.label` before the message. This was previously exposed as * { label: 'my label' } to transports in `winston < 3.0.0`. */ export default format<LabelOptions>((info, opts = {}) => { if (opts.message) { info.message = `[${opts.label}] ${info.message}` return info } info.label = opts.label return info }) |