nightingale-app-console
TypeScript icon, indicating that this package has built-in type declarations

15.0.0 • Public • Published

nightingale-app-console

nightingale default config and logger for app

Install

npm install --save nightingale-app-console

Usage

import { appLogger } from 'nightingale-app-console';

appLogger.info('hello');

Create children

const myServiceLogger = appLogger.child('services:myService');
myServiceLogger.debug('started');

The Logger class

See the Logger API, with all the methods you call to log things.

Library

If you're writing a library, use only nightingale-logger

Import the right bundle with webpack

Configure webpackConfig.resolve.mainFields:

  • node: env === 'production' ? ['module:node', 'module', 'main'] : ['module:node-dev', 'module:node', 'module-dev', 'module', 'main']
  • browser: env === 'production' ? ['browser', 'module', 'main'] : ['browser-dev', 'browser', 'module-dev', 'module', 'main']
  • modern browser: env === 'production' ? ['module:modern-browsers', 'browser', 'module', 'main'] : ['module:modern-browsers-dev','module:modern-browsers', 'browser-dev', 'browser', 'module', 'main']

Change default levels

Default level for app (appLogger and children): in production, Level.INFO () else Level.DEBUG Default level for lib: Level.INFO

You can use process.env.NIGHTINGALE_APP_MIN_LEVEL and process.env.NIGHTINGALE_LIB_MIN_LEVEL to change theses levels.

NIGHTINGALE_APP_MIN_LEVEL=0 node .

Use source maps to display error stack trace

Readme

Keywords

none

Package Sidebar

Install

npm i nightingale-app-console

Weekly Downloads

163

Version

15.0.0

License

ISC

Unpacked Size

34.8 kB

Total Files

12

Last publish

Collaborators

  • churpeau