Skip to content

v2.0.0

Choose a tag to compare

@haltcase haltcase released this 23 Apr 16:26
· 37 commits to master since this release

v2.0.0 is a significant release — logger-neue has been entirely rewritten in strict TypeScript. On top of an improved API and providing a stronger developer experience with its included type definitions, several minor potential bugs were fixed during the rewrite.

Since this is a major release, there are several breaking changes:

  • Minimum supported Node version of 6

  • import usage

    The default export is now a function rather than the LoggerNeue class — which is now a separate named export if you need it.

    import loggerNeue, { LoggerNeue } from 'logger-neue'
    
    const log = loggerNeue()
    const log2 = new LoggerNeue()

    However be aware that these are not exactly equivalent for TypeScript users. The function is a wrapper around the class that serves to provide more accurate type definitions based on the level descriptors you provide at construction time.

    const log = loggerNeue({
      levels: {
        greet: [0, 'red']
      }
    })
    
    // you'll get type hints on this!
    log.greet('hi!')
  • ES5 / commonjs require

    ES5 / commonjs users will need to use the .default property when
    requireing:

    const loggerNeue = require('logger-neue').default
  • level descriptors

    When defining new levels using object syntax, the property formerly known as colors is now called style to better reflect that chalk styles other than colors such as underline and bold are also accepted.

FEATURES
BREAKING CHANGES
  • colors in level descriptor objects is now known as style.
  • the default export is no longer a class, but instead is a function. The class is now a named export.
  • non-ES module / TS users must use require('logger-neue').default.
  • support for Node < 6 has been dropped.