0.0.10 • Published 7 years ago

angular2-loggly-logger v0.0.10

Weekly downloads
18
License
MIT
Repository
github
Last release
7 years ago

angular2-loggly-logger

Description

Simple library to log to loggly in Angular2

Installation

To install follow this procedure:

  1. npm install angular2-loggly-logger --save
  2. Add LogglyService import to your @NgModule like example below

    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { MyTestApp } from './my-test-app';
    import { LogglyService } from 'angular2-loggly-logger';
    
    @NgModule({
        providers:    [ LogglyService ],
        imports:      [ BrowserModule ],
        declarations: [ MyTestApp ],
        bootstrap:    [ MyTestApp ]
    })
    export class MyTestAppModule {}
  3. Use the following in your components, etc.

    import {LogglyService} from 'angular2-loggly-logger';
    
    constructor(private _logglyService:LogglyService) {
        }
        
    // Init to set key and tag and sendConsoleErrors boolean    
    this._logglyService.push({
        'logglyKey': 'Your Loggly Key goes here',
        'sendConsoleErrors' : true, // Optional set true to send uncaught console errors
        'tag' : 'loggly-logger'
    });
    
    
    // To send logs to loggly
    this._logglyService.push('Your log message');