0.9.0 • Published 4 years ago

logtry v0.9.0

Weekly downloads
55
License
MIT
Repository
github
Last release
4 years ago

Logtry

NPM

Automated Tests devDependencies Status

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

KeyRequiredDescription
LOGGER_NAMEyesSets the name of the logger.
LOGGER_LEVELyesSet the minimum level of logs.
SENTRY_DSNnoSentry DSN key (sentry-doc)
LOGGLY_TOKENnoLoggly token (loggly-doc)
LOGGLY_SUBDOMAINnoLoggly 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.