winston v3.2.0 Release Notes

Release Date: 2019-01-26 // about 5 years ago
  • SORRY IT TOO SO LONG EDITION

    NOTE: this was our first release using Github Projects. See the πŸš€ > 3.2.0 Release Project.

    πŸ†• New Features!

    • [#1471], (@kibertoad) Implement child loggers.
    • πŸ‘ [#1462], (@drazisil) Add handleRejection support.
      • [#1555], (@DABH) Add fixes from [#1355] to unhandled rejection handler.
    • [#1418], (@mfrisbey) Precompile ES6 syntax before publishing to npm.
      • [#1533], (@kibertoad) Update to Babel 7.
    • πŸ‘ [#1562], (@indexzero) [fix] Better handling of new Error(string) throughout the pipeline(s). (Fixes [#1338], [#1486]).

    πŸ› Bug Fixes

    • πŸ›  [#1355], (@DABH) Fix issues with ExceptionHandler (Fixes [#1289]).
    • [#1463], (@SerayaEryn) Bubble transport warn events up to logger in addition to errors.
    • [#1480], [#1503], (@SerayaEryn) File tailrolling fix.
    • 🌲 [#1483], (@soldair) Assign log levels to un-bound functions.
    • [#1513], (@TilaTheHun0) Set maxListeners for Console transport.
    • [#1521], (@jamesbechet) Fix Transform from readable-stream using CRA.
    • πŸ›  [#1434], (@Kouzukii) Fixes logger.query function (regression from 3.0.0)
    • πŸ›  [#1526], (@pixtron) Log file without .gz for tailable (Fixes [#1525]).
    • [#1559], (@eubnara) Fix typo related to exitOnError.
    • 🌲 [#1556], (@adoyle-h) Support to create log directory if it doesn't exist for FileTransport.

    πŸ†• New splat behavior

    • [#1552], (@indexzero) Consistent handling of meta with (and without) interpolation in winston and logform.
    • πŸ›  [#1499], (@DABH) Provide all of SPLAT to formats (Fixes [#1485]).
    • [#1485], (@mpabst) Fixing off-by-one when using both meta and splat.

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

    As of [email protected], format.splat assumes additional splat paramters πŸ”€ (aka "metas") are objects and merges enumerable properties into the info. e.g. BE ADVISED previous "metas" that were not objects will very likely lead to odd behavior. e.g.

    const { createLogger, format, transports } = require('winston');
    const { splat } = format;
    const { MESSAGE, LEVEL, SPLAT } = require('triple-beam');
    
    const logger = createLogger({
      format: format.combine(
        format.splat(),
        format.json()
      ),
      transports: [new transports.Console()]
    });
    
    // Expects two tokens, but four splat parameters provided.
    logger.info(
      'Let us %s for %j',   // message
      'objects',           // used for %s
      { label: 'sure' },   // used for %j
      'lol', ['ok', 'why'] // Multiple additional meta values 
    );
    
    // winston < 3.2.0 && [email protected] 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' } ] }
    
    // winston >= 3.2.0 && [email protected] behavior: Enumerable properties
    // assigned into `info`. Since **stringsΒ and Arrays only have NUMERIC
    // enumerable properties we get this behavior!**
    //
    // { '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' } ] }