Readable And Configurable Console Log For Angular App – fancy-logger

Author: ngdevelop-tech
Official Page: Go to website
Publish Date: May 5, 2020
License: MIT

Description:

fancy-logger is a readable and configurable console log library for Angular applications.

Features:

  • Info, Debug, Warning, and Error log levels.
  • Custom log time/label/header/emoji.

Basic usage:

1. Install and import the module.

import { NgxFancyLoggerModule } from 'ngx-fancy-logger';
@NgModule({
  imports: [
    NgxFancyLoggerModule
  ]
})
export class AppModule { }
# NPM
$ npm install ngx-fancy-logger --save

2. A simple example to show logs.

export class AppComponent {
  title = 'demo';
  constructor(private logger: NgxFancyLoggerService) {
    logger.header('This is a Ngx Fancy Logger Demo', { color: 'red', fontSize: 30 });
    logger.info('This is a INFO log', 123, { a: 20, b: 30 });
    logger.debug('This is a DEBUG Log', { a: 20, b: 30 });
    logger.warning('This is a WARNING Log', { a: 20, b: 30 });
    logger.error('This is an ERROR Log', { a: 20, b: 30 });
    logger.header('Observable Log Message using debugOperator() ');
    const source$ = of(Math.random(), { test: 'data' }, 123, 'This  is source observable data');
    source$.pipe(
      logger.debugOperator('Source Response : ', LogLevel.INFO),
      map(data => ({ key: Math.random(), response: data}) ),
      logger.debugOperator('Mapped Response : ')
    ).subscribe();
  }
}

Preview:

Readable And Configurable Console Log For Angular App - fancy-logger


You Might Be Interested In:

Tags:

Add Comment