angular-ny-logger

AngularJS Logger service provider

Added by: Sam Deering

GitHub

Repository

naorye/angular-ny-logger

Stats

Stars: 30

Watchers: 30

Forks: 12

Author

Naorye
Naorye

Module Description

#angular-ny-logger

AngularJS Logger service provider

Getting Started

This is a AngularJS Logger service provider plugin. After integrating this service with your application you will be able to get informative logs as well as turn them off in production.

More information can be found here: http://www.webdeveasy.com/service-providers-in-angularjs-and-logger-implementation

Usage

  1. Include angular-ny-logger.js in your JavaScript files.

  2. Add ny.logger module as a dependency to your module:

    angular.module('YourModule', ['ny.logger'])
    
  3. Make a configuration block that turns on or off logging:

    module.config(['LoggerProvider', function(LoggerProvider) {
        // We don't want the Logger service to be enabled in production
        LoggerProvider.enabled(!isProduction);
    }]);
    
  4. Start logging like a pro with informative logs:

    module.controller('ExampleController', ['Logger', function(Logger) {
        var logger = Logger.getInstance('ExampleController');
        logger.log('This is a log');
        logger.warn('warn', 'This is a warn');
        logger.error('This is a {0} error! {1}', [ 'big', 'just kidding' ]);
        logger.debug('debug', 'This is a debug for line {0}', [ 8 ]);
    }]);
    

Copyright (c) 2014 naorye

Module stats last updated: 2017-03-19 16:00:05

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!