Package Exports
- logtry
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (logtry) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Logtry
A Pino configurable logger for NodeJS to send logs to loggly and sentry
Requirements
Minimum Node.js version: 10
Installation
npm install --save logtryConfiguration
| 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
'use strict';
const logger = require('logtry');
// 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'), anotherField: 'extra context' }, 'error message');
// Log a warning message:
logger.warn({ err: new Error('Warn'), userId:'1e7b8d', age: 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');
