Angular Logging

From bibbleWiki
Revision as of 23:36, 22 April 2021 by Iwiseman (talk | contribs) (Created page with "=Introduction= This is just an approach to logging not the approach =ngx-logger= ==Install== <syntaxhighlight lang="bash"> npm install ngx-logger --save </syntaxhighlight> ==C...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Introduction

This is just an approach to logging not the approach

ngx-logger

Install

npm install ngx-logger --save

Configure

import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { LoggerModule, NgxLoggerLevel } from 'ngx-logger';

import { AppComponent } from './app.component';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    HttpClientModule,
    LoggerModule.forRoot({
      serverLoggingUrl: '/api/logs',
      level: NgxLoggerLevel.DEBUG,
      serverLogLevel: NgxLoggerLevel.ERROR,
    }),
  ],
  providers: [],
  bootstrap: [AppComponent],
})
export class AppModule {}