开发者社区> 镜像站> NPM> pelias-logger
pelias-logger
The centralized logger package for Pelias.
Last updated 7 months ago by pelias .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install pelias-logger 
SYNC missed versions from official npm registry.

This repository is part of the Pelias project. Pelias is an open-source, open-data geocoder originally sponsored by Mapzen. Our official user documentation is here.

Pelias Logger

The centralized logger package for Pelias, which wraps winston with Pelias-specific transports and default configurations.

Greenkeeper badge NPM

Config

The logger will set its log levels to the logger.level property in pelias-config, which should be set to any of the default winston options. logger.timestamp and logger.colorize take boolean values (defaulting to true) that indicate whether log lines should have a timestamp/be colorized.

Interface

get( name, loggerOpts )

Retrieve a logger with a specific name or, if none is found, create a new one.

  • name: the name to search for/assign to the logger
  • loggerOpts: if a new logger has to be created, the options to pass to winston.Logger()
winston

The winston package is exposed via this option, to provide access to any items needed in custom loggerOpts passed to get() (like winston.transports.* classes).

Example

var peliasLogger = require( 'pelias-logger' );
var logger1 = peliasLogger.get( 'logger1' );
var logger2 = peliasLogger.get( 'logger2', {
	transports: [
		new peliasLogger.winston.transports.File( {
			filename: 'output.txt',
			timestamp: true
		})
	]
});
logger1.warn( 'hello' );

Current Tags

  • 1.5.0                                ...           latest (7 months ago)

25 Versions

  • 1.5.0                                ...           7 months ago
  • 1.4.1                                ...           2 years ago
  • 1.4.0                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
  • 0.5.0                                ...           2 years ago
  • 0.4.2                                ...           2 years ago
  • 0.4.1                                ...           3 years ago
  • 0.4.0                                ...           3 years ago
  • 0.3.1                                ...           3 years ago
  • 0.3.0                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.8                                ...           6 years ago
  • 0.0.7                                ...           6 years ago
  • 0.0.6                                ...           6 years ago
  • 0.0.4                                ...           6 years ago
  • 0.0.3                                ...           6 years ago
  • 0.0.2                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
  • 0.0.0                                ...           6 years ago