Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

logform

Package Overview
Dependencies
Maintainers
4
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

logform - npm Package Versions

134

2.3.0

Diff

Changelog

Source

2.3.0

2021/09/21

  • Update dependencies
  • Removing some superfluous semicolons & commas lint
  • Avoid dynamic requires [#117]
  • Replace JSON stringify library "fast-safe-stringify" by "safe-stable-stringify" [#98]
  • More correctly format errors even if the “message” property is enumerable [#101]
  • Fix errors and ms export for browsers [#106]
dabh
published 2.2.0 •

Changelog

Source

2.2.0

2020/06/21

  • [#90], [#91] Add option for using stable stringify when formatting as JSON.
  • [#84] Add replacer for BigInt on JSON formatter.
  • [#79] Timestamp format type definitions can accept functions.
  • Update dependencies and fix most of the oustanding npm audit notices.
indexzero
published 2.1.2 •

Changelog

Source

2.1.2

2019/01/31

  • [#74] Remove all internal symbols before invoking util.inspect.
    • Related to [#31].
indexzero
published 2.1.1 •

Changelog

Source

2.1.1

2019/01/29

  • [#71] Bump logform to be consistent with winston.
    • Fixes https://github.com/winstonjs/winston/issues/1584
indexzero
published 2.1.0 •

Changelog

Source

2.1.0

2019/01/07

  • [#59], [#68], [#69] Add error normalizing format.
  • [#65] When MESSAGE symbol has a value and { all: true } is set, colorize the entire serialized message.
indexzero
published 2.0.0 •

Changelog

Source

2.0.0

2018/12/23

  • BREAKING [#57] Try better fix for [winston#1485]. See: New splat behavior` below.
  • [#54] Fix typo in README.md
  • [#55] Strip info[LEVEL] in prettyPrint. Fixes [#31].
  • [#56] Document built-in formats.
  • [#64] Add TypeScript definitions for all format options. Relates to [#9] and [#48].
New splat behavior

Previously splat would have added a meta property for any additional info[SPLAT] beyond the expected number of tokens.

As of logform@2.0.0, format.splat assumes additional splat paramters (aka "metas") are objects and merges enumerable properties into the info. e.g.

const { format } = require('logform');
const { splat } = format;
const { MESSAGE, LEVEL, SPLAT } = require('triple-beam');

console.log(
  // Expects two tokens, but three splat parameters provided.
  splat().transform({
    level: 'info',
    message: 'Let us %s for %j',
    [LEVEL]: 'info',
    [MESSAGE]: 'Let us %s for %j',
    [SPLAT]: ['objects', { label: 'sure' }, { thisIsMeta: 'wut' }]
  })
);

// logform@1.x behavior:
// Added "meta" property.
//
// { level: 'info',
//   message: 'Let us objects for {"label":"sure"}',
//   meta: { thisIsMeta: 'wut' },
//   [Symbol(level)]: 'info',
//   [Symbol(message)]: 'Let us %s for %j',
//   [Symbol(splat)]: [ 'objects', { label: 'sure' } ] }

// logform@2.x behavior:
// Enumerable properties assigned into `info`.
//
// { level: 'info',
//   message: 'Let us objects for {"label":"sure"}',
//   thisIsMeta: 'wut',
//   [Symbol(level)]: 'info',
//   [Symbol(message)]: 'Let us %s for %j',
//   [Symbol(splat)]: [ 'objects', { label: 'sure' } ] }

The reason for this change is to be consistent with how winston itself handles meta objects in its variable-arity conventions.

BE ADVISED previous "metas" that were not objects will very likely lead to odd behavior. e.g.

const { format } = require('logform');
const { splat } = format;
const { MESSAGE, LEVEL, SPLAT } = require('triple-beam');

console.log(
  // Expects two tokens, but three splat parameters provided.
  splat().transform({
    level: 'info',
    message: 'Let us %s for %j',
    [LEVEL]: 'info',
    [MESSAGE]: 'Let us %s for %j',
    // !!NOTICE!! Additional parameters are a string and an Array
    [SPLAT]: ['objects', { label: 'sure' }, 'lol', ['ok', 'why']]
  })
);

// logform@1.x behavior:
// Added "meta" property.
//
// { level: 'info',
//   message: 'Let us objects for {"label":"sure"}',
//   meta: ['lol', ['ok', 'why']],
//   [Symbol(level)]: 'info',
//   [Symbol(message)]: 'Let us %s for %j',
//   [Symbol(splat)]: [ 'objects', { label: 'sure' } ] }

// logform@2.x behavior: Enumerable properties assigned into `info`.
// **Strings and Arrays only have NUMERIC enumerable properties!**
//
// { '0': 'ok',
//   '1': 'why',
//   '2': 'l',
//   level: 'info',
//   message: 'Let us objects for {"label":"sure"}',
//   [Symbol(level)]: 'info',
//   [Symbol(message)]: 'Let us %s for %j',
//   [Symbol(splat)]: [ 'objects', { label: 'sure' } ] }
indexzero
published 1.10.0 •

Changelog

Source

1.10.0

2018/09/17

  • [#52] Add types field in package.json.
  • [#46], [#49] Changes for splat when there are no tokens present and no splat present.
  • [#47], [#53] Expose transpiled code for Browser-only scenarios.
indexzero
published 1.9.1 •

Changelog

Source

1.9.1

2018/06/26

  • [#39] Don't break when there are % placeholders but no values.
  • [#42] Only set meta when non-zero additional SPLAT arguments are provided. (Fixes [winstonjs/winston#1358]).
indexzero
published 1.9.0 •

Changelog

Source

1.9.0

2018/06/12

  • [#38] Migrate functionality from winston Logger to splat format.
  • [#37] Match expectations from winston@2.x for padLevels. Create a correct Cli format with initial state. (Fixes [#36]).
indexzero
published 1.8.0 •

Changelog

Source

1.8.0

2018/06/11

  • [#35] Use fast-safe-stringify for perf and to support circular refs.
  • [#34] Colorize level symbol.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc