angular-logz-io
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

angular-logz-io

Integrate logzio logging in your Angular app.

Installation

npm i --save logzio-ts angular-logz-io

How to use in app code

In order to use angular-logz-io in your module, add the following definitions:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
 
import { AppComponent } from './app.component';
import { AngularLogzIoModule, LogzioOptions, AbstractLogger, AngularLogzIoService } from 'angular-logz-io';
 
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AngularLogzIoModule
  ],
  providers: [
    { provide: LogzioOptions, useValue: { token: 'YOUR_LOGZIO_TOKEN' }},
    { provide: AbstractLogger, useClass: AngularLogzIoService},
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

You can then inject the AbstractLogger service to use it in a component:

constructor(private logz: AbstractLogger) {}

Logging is very simple to use:

testService() {
  console.log('Logging to logz.io');
  this.logz.info('got event logzio');
}

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i angular-logz-io

    Weekly Downloads

    26

    Version

    0.0.3

    License

    none

    Unpacked Size

    104 kB

    Total Files

    26

    Last publish

    Collaborators

    • tomyitav