This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

ng-env-logger
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

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.

Package Sidebar

Install

npm i ng-env-logger

Weekly Downloads

6

Version

1.1.0

License

MIT

Unpacked Size

137 kB

Total Files

30

Last publish

Collaborators

  • pjlamb12