0.9.0 • Published 4 years ago
logtry v0.9.0
Logtry
A Pino configurable logger for NodeJS to send logs to loggly and sentry
Requirements
Minimum Node.js version: 10
Installation
npm install --save logtry
Configuration
Key | Required | Description |
---|---|---|
LOGGER_NAME | yes | Sets the name of the logger. |
LOGGER_LEVEL | yes | Set the minimum level of logs. |
SENTRY_DSN | no | Sentry DSN key (sentry-doc) |
LOGGLY_TOKEN | no | Loggly token (loggly-doc) |
LOGGLY_SUBDOMAIN | no | Loggly subdomain (loggly-doc) |
Use
// Using modules
import logger from 'logtry';
// or if using common.js
const logger = require('logtry').default;
// Log a fatal error message:
logger.fatal({ err: new Error('Fatal'), field: 'additional info' }, 'fatal message');
// Log an error message:
logger.error({ err: new Error('Error'), data: 'extra data' }, 'error message');
// Log a warning message:
logger.warn({ err: new Error('Warn'), home: 17 }, 'Warning while getting info');
// Log an informational message:
logger.info({ field: 1 }, 'info message');
// Log a debug message:
logger.debug({ user }, 'debug message');
// Log a trace message:
logger.trace({ fields: [1, 2, 66]] }, 'trace message');
MIT Licensed
Contributing
Pull requests are always welcomed. 🙇🏻♂️ Please open an issue first to discuss what you would like to change.
Support
If you have any questions or need help with integration, then you can contact me by email alex.abidri@gmail.com.