ng2loggerbasic
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Instructions

  1. npm install ng2loggerbasic
  2. Modify your system-config.ts to include ng2loggerbasic
            const barrels: string[] = [

          // Angular specific barrels.

          // Thirdparty barrels.           'ng2loggerbasic',

          // App specific barrels.           'app',

          /** @cli-barrel */         ];

        ...

        ...

        // Apply the CLI SystemJS configuration.

        System.config({

          map: {

            '@angular': 'vendor/@angular',

            'ng2loggerbasic': 'vendor/ng2loggerbasic',

            //other inclusions...

          },

          packages: cliSystemConfigPackages

        });
3. Modify your angular-cli-build.js

   module.exports = function(defaults) {

   return new Angular2App(defaults, {

    vendorNpmFiles: [

      //other relevant file paths,

      'ng2loggerbasic/**/*.js'

    ]

   });

   };
4. In your app component

   import {LoggerService} from 'ng2loggerbasic/ng2-logger-basic';

   @Component({

   ...

      providers:[provide(LoggerService, {

                          useFactory: () => {

                            return new LoggerService(LOG_LEVEL);

                          }

              })]

   })              

   ...

   export class Application {

     constructor(private _logger: LoggerService) {

        this._logger.debug('#Application constructor#');

     }

   }
Note: These instruction are specifically for an angular2/ng2 2.0.0-rc.1 & angular-cli 0.0.39 based project. 

It hasn't been tested on other versions (given the fact angular rc3 /cli is still a bit flaky as of this writing)

Readme

Keywords

none

Package Sidebar

Install

npm i ng2loggerbasic

Weekly Downloads

0

Version

0.0.2

License

ISC

Last publish

Collaborators

  • ramachandrann