2.2.3 • Published 6 years ago

@sinet/logger v2.2.3

Weekly downloads
1
License
(c) School Improv...
Repository
github
Last release
6 years ago

Logger

Build Status Dependency Status devDependency Status

Winston logger to use with the Logstash and Kibana.

Usage

npm install @sinet/logger --save

Example

// Options are for winston transports, file and console
var options = {
	'file' : {
		// File transport is enabled on development and production environment
		'enabled'  : [ 'development', 'production' ],
		'filename' : 'logs/myLogFile.log',
	},

	'console' : {
		// Console transport is enabled only in development environment
		'enabled' : [ 'development' ],
		'level'   : 'debug'
	},

	'logstash' : {
		'enabled' : [ 'production' ],
		'port'    : 9563
	},

	// These are additional fields that get added to all logs
	'additional' : {
		'container' : 'user-service',

		// The items below are defaults added by the library automatically
		'hostname'   : os.hostname(),
		'dockerhost' : process.env.DOCKER_HOST || 'undefined'
	}
};

var logger = require( '@sinet/logger' )( options );

logger.error( 'error message', { 'method': 'v1.users.get', 'payload', payload } );

FAQs

  1. What happens when I add a file or console option without setting the enabled property?
// Example
var options = {
	'file'    : {},
	'console' : {}
}

Answer: If file and/or console is explicitly provided without setting the enabled property it will log in any environment.

Contributing

All pull requests must follow coding conventions and standards.

2.2.3

6 years ago

2.2.2

7 years ago

2.2.1

8 years ago

2.2.0

8 years ago

1.1.1

8 years ago

1.1.0

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago