# ng-env-logger

> Angular service to facilitate logging based on environment.

Latest version **1.1.0** (published 2018-12-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install ng-env-logger
pnpm add ng-env-logger
yarn add ng-env-logger
bun add ng-env-logger
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-12-05 |
| First published | 2018-07-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 134 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Preston Lamb |
| Maintainers | pjlamb12 |
| Keywords | angular, logger, console.log, logging service |

## Links

- npm: https://www.npmjs.com/package/ng-env-logger
- Repository: https://github.com/pjlamb12/ng-log
- Homepage: https://stackblitz.com/edit/ng-env-logger
- Issues: https://github.com/pjlamb12/ng-log/issues
- npm.io page: https://npm.io/package/ng-env-logger

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^1.9.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

- 1.1.0 (latest) — 2018-12-05
- 1.0.4 — 2018-12-04
- 1.0.3 — 2018-10-25
- 1.0.2 — 2018-07-20
- 1.0.1 — 2018-07-20
- 1.0.0 — 2018-07-20

## README

# `ng-env-logger` — Angular Logging Service Package

How many times have you left a rogue `console.log` in your production code? That's the worst, right? This package will help keep that from occurring.

This package logs to the console by giving you multiple levels to write:

1.  error
2.  warn
3.  info
4.  debug
5.  log

When the service is initialized, you provide a level for it to write. So, for example, if you provide the `WARN` level (number 2), `this.logService.info()`, `.debug()`, and `.log()` calls are ignored; only the `.warn()` and `.error()` functions continue to work. This will allow you to log certain messages or objects in development without worrying about removing them for your production version of the app. Whichever level you choose, the service logs that number and lower to the console.

To use the service, add the following to your `AppModule`'s imports array:

    NgLogModule.forRoot({ level: LogLevels.WARN }),

To update the logging level, call the `updateLogLevel` function on the service and pass it a one of the above levels. The provided number does have to be between 1 and 5, which are the values that the enum LogLevels provides.

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