# logtry

> A Pino configurable logger for NodeJS to send logs to loggly and sentry

Latest version **0.9.0** (published 2020-09-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install logtry
pnpm add logtry
yarn add logtry
bun add logtry
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.9.0 |
| Published | 2020-09-09 |
| First published | 2020-06-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | 12.18 |
| Dependencies | 9 |
| Unpacked size | 26.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alexandre Abidri |
| Maintainers | alexabidri |
| Keywords | logger, loggly, logging, node, tools, sentry, transport, pino |

## Links

- npm: https://www.npmjs.com/package/logtry
- Repository: https://github.com/alexabidri/logtry
- Homepage: https://github.com/alexabidri/logtry#readme
- Issues: https://github.com/alexabidri/logtry/issues
- npm.io page: https://npm.io/package/logtry

## Dependencies (9)

- [pino](https://npm.io/package/pino.md) 6.6.0
- [@types/pino](https://npm.io/package/@types/pino.md) 6.3.0
- [@sentry/node](https://npm.io/package/@sentry/node.md) 5.22.3
- [node-loggly-bulk](https://npm.io/package/node-loggly-bulk.md) 2.2.4
- [pino-multi-stream](https://npm.io/package/pino-multi-stream.md) 5.1.1
- [json-stringify-safe](https://npm.io/package/json-stringify-safe.md) 5.0.1
- [@types/node-loggly-bulk](https://npm.io/package/@types/node-loggly-bulk.md) 2.2.0
- [@types/pino-multi-stream](https://npm.io/package/@types/pino-multi-stream.md) 5.0.0
- [@types/json-stringify-safe](https://npm.io/package/@types/json-stringify-safe.md) 5.0.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.9.0 (latest) — 2020-09-09
- 0.8.0 — 2020-08-11
- 0.7.0 — 2020-07-10
- 0.6.0 — 2020-07-10
- 0.5.0 — 2020-06-30
- 0.4.0 — 2020-06-30
- 0.3.0 — 2020-06-29
- 0.2.0 — 2020-06-26
- 0.1.0 — 2020-06-26

## README

# Logtry

[![NPM](https://nodei.co/npm/logtry.png)](https://nodei.co/npm/logtry/)

![Automated Tests](https://github.com/alexabidri/logtry/workflows/Automated%20Tests/badge.svg) [![devDependencies Status](https://david-dm.org/bevry/badges/dev-status.svg)](https://david-dm.org/bevry/badges?type=dev)

A Pino configurable logger for NodeJS to send logs to loggly and sentry

<!-- TOC depthFrom:2 -->

- [Requirements](#requirements)
- [Installation](#installation)
- [Configuration](#configuration)
- [Use](#use)

<!-- /TOC -->

## Requirements

Minimum Node.js version: 10

## Installation

```bash
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](https://docs.sentry.io/clients/java/config/#setting-the-dsn))                                                                                                  |
| `LOGGLY_TOKEN`     | no       | Loggly token ([loggly-doc](https://documentation.solarwinds.com/en/Success_Center/loggly/Content/admin/token-based-api-authentication.htm?cshid=loggly_token-based-api-authentication))     |
| `LOGGLY_SUBDOMAIN` | no       | Loggly subdomain ([loggly-doc](https://documentation.solarwinds.com/en/Success_Center/loggly/Content/admin/token-based-api-authentication.htm?cshid=loggly_token-based-api-authentication)) |

## Use

```javascript
// 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](alex.abidri@gmail.com).

---
_Source: https://npm.io/package/logtry · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
