Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tomyitav/angular-logzio

Log from your angular app to logzio
https://github.com/tomyitav/angular-logzio

angular dependency-injection elk logging logzio

Last synced: about 4 hours ago
JSON representation

Log from your angular app to logzio

Awesome Lists containing this project

README

        

# angular-logz-io

[![npm](https://img.shields.io/npm/v/angular-logz-io.svg)](https://www.npmjs.com/package/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:

```js
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:

```js
constructor(private logz: AbstractLogger) {}
```

Logging is very simple to use:
```js
testService() {
console.log('Logging to logz.io');
this.logz.info('got event logzio');
}
```