开发者社区> 镜像站> NPM> @dkuida/logger-wrapper
@dkuida/logger-wrapper
commodity wrapper
Last updated a year ago by dkuida .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @dkuida/logger-wrapper 
SYNC missed versions from official npm registry.

Build Status

wrapper for winston configuration loader

Build Setup

# Install dependencies
npm install @dkuida/logger-wrapper

usage

short version

check the example folder

###longer version the config file will initialize the availbale transports by passing the configuration to each

  • console - official winston console

  • file - official winston file logger

  • fluentd - using fluent-logger

  • logstash - have a look at winston-logstash-transport

  • service - a common name that will be identify the project/service create a singleton loader in the form of

 import logger from '@dkuida/logger-wrapper';
 import * as loggerConfig from './config/logger';
 const loggerInstance = logger(loggerConfig);
 
 export default loggerInstance;

use the logger wherever you need

import loggerInstance from './logger';
const logger = loggerInstance(module);
logger.info('HELLO');

The label for the log message is extracted from the (module) - and is the file in which the call was invoked. In case you use moleculer.js you can add a property

labelExtractors: [LabelExtractor.moleculer]

which allow on service call to extract the labels for the nodes/brokers

Breaking changes

1.6.x
  • winston, winston-logstash-transport, fluentd-logger are all peer dependencies now.
1.5.x
  • the logger is not exported as default from the library
  • fatal level removed

License

The project is available under the MIT license.

Current Tags

  • 1.6.0-beta5                                ...           latest (a year ago)

19 Versions

  • 1.6.0-beta5                                ...           a year ago
  • 1.6.0-beta3                                ...           a year ago
  • 1.6.0-beta1                                ...           a year ago
  • 1.6.0-beta0                                ...           a year ago
  • 1.5.3                                ...           2 years ago
  • 1.5.2                                ...           2 years ago
  • 1.5.1                                ...           2 years ago
  • 1.4.24                                ...           2 years ago
  • 1.4.23                                ...           2 years ago
  • 1.4.22                                ...           2 years ago
  • 1.4.16                                ...           2 years ago
  • 1.4.15                                ...           2 years ago
  • 1.4.14                                ...           2 years ago
  • 1.4.13                                ...           2 years ago
  • 1.4.12                                ...           2 years ago
  • 1.4.11                                ...           2 years ago
  • 1.4.10                                ...           2 years ago
  • 1.4.9                                ...           2 years ago
  • 1.4.8                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 19
Dependencies (0)
None
Dev Dependencies (18)
Dependents (0)
None