@idpartner/logger
v1.1.1
Published
Wrapper for winston package. The purpose of this library is to allow the team to change the underlying technology (if need be) without having to change the interface already used by our services.
Downloads
7
Keywords
Readme
@idpartner/logger
Wrapper for winston package. The purpose of this library is to allow the team to change the underlying technology (if need be) without having to change the interface already used by our services.
Usage
const Logger = require('@idpartner/logger');
const logger = Logger({
// Set log level
level: 'debug',
// Set metadata that will be present in all logs
defaultMeta: { version: '1.0.0', service: 'dashboard-service' }
});
// Simple usage
logger.info('test info level message');
logger.warn('test warn level message');
logger.error('test error level message');
// Usage with extra metadata
logger.info('test info level message', { timestamp: Date.now() });
logger.warn('test warn level message', { warningCode: 568 });
logger.error('test error level message', { errorMessage: 'Something went wrong') });