# err-loggr

> This is a small lib to help create and manage log files

Latest version **1.2.0** (published 2019-01-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install err-loggr
pnpm add err-loggr
yarn add err-loggr
bun add err-loggr
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2019-01-11 |
| First published | 2018-10-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Nikhil Palli |
| Maintainers | npalli12 |
| Keywords | error, logger, loggr, file, email, log, emailr, errors, err |

## Links

- npm: https://www.npmjs.com/package/err-loggr
- npm.io page: https://npm.io/package/err-loggr

## Dependencies (2)

- [moment](https://npm.io/package/moment.md) ^2.22.2
- [sendmail](https://npm.io/package/sendmail.md) ^1.4.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2019-01-11
- 1.1.4 — 2018-11-27
- 1.1.3 — 2018-11-27
- 1.1.2 — 2018-11-27
- 1.1.1 — 2018-11-26
- 1.1.0 — 2018-11-26
- 1.0.3 — 2018-10-22
- 1.0.2 — 2018-10-17
- 1.0.1 — 2018-10-17
- 1.0.0 — 2018-10-17

## README

# err-loggr

### This script requires Node.js

__You can find more about node.js here:__ https://nodejs.org/

### Description
This library will be help manage the creatition and writing of log files.

### Requirements
- Git
- Node.js
- npm or yarn

### Setup 
- This library is available on npm
```
npm install err-loggr s 
// or
yarn add err-loggr
```

### Website
- https://www.npmjs.com/package/err-loggr

### General Case
```
/**
* creats a dir called log 
* creates a log file LOG FILE - (mm/dd/yy)
*/
const Loggr = require('err-loggr');
const loggr = new Loggr();

loggr.error('TEST ERROR MESSAGE',8);
//writes to file
/**
* ERROR - 03:24PM
* OCCURED ON LINE: 8
* TEST ERROR MESSAGE
*/


loggr.message('TEST MESSAGE',9)
//writes to file
/**
* MESSAGE - 03:24PM
* OCCURED ON LINE: 9
* TEST MESSAGE
*/
```

### Name your file
```
/**
* create a dir with desired name
* create a log file with desired name and tags with mm/dd/yy (desiredLogFileName - mm/dd/yy)
*/

const Loggr = require('err-loggr');
const loggr = new Loggr('fileName','path/to/dir');

/**
 * path
 * |____to
 *      |____dir
 *           |____fileName     
 */
```
### Email Options

```
let mailOptions = {
    to: 'name@example.com',              //required
    from:'yourname@example.com',         //default to err@loggr.com
    cc:'someone@example.com',            //default null
    bcc:'someoneelse@example.com',       //default null
    subject:'Test send file'             //default LOG - base dirname
    maxAttempts:5                        //default 3 attempts to send email if failure occurs
}

/**
* This sends an email of your file with the mail options above.
* 
* Use if (loggr.error.length){} call if you only want an email sent in case of errors
* If you want the receive an email no matter what, you can just use the loggr.email() call
* 
*/
if(loggr.errors.length >0){
    loggr.email(mailOptions)
}
;

```
### Change Log
    - 11/26/2018 - Added email function
    - 1/11/2018 - Update email function

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