File

src/app/shared/services/logger.service.ts

Description

A service for global logs.

Example

Index

Methods

Constructor

constructor()

Methods

Static error
error(value: any, ...rest: any[])
Parameters :
Name Type Optional Description
value any
rest any[]
Returns : void
error
error(value: any, ...rest: any[])
Parameters :
Name Type Optional Description
value any
rest any[]
Returns : void
Static log
log(value: any, ...rest: any[])
Parameters :
Name Type Optional Description
value any
rest any[]
Returns : void
log
log(value: any, ...rest: any[])
Parameters :
Name Type Optional Description
value any
rest any[]
Returns : void
Static warn
warn(value: any, ...rest: any[])
Parameters :
Name Type Optional Description
value any
rest any[]
Returns : void
warn
warn(value: any, ...rest: any[])
Parameters :
Name Type Optional Description
value any
rest any[]
Returns : void
import { Injectable } from '@angular/core';
import { environment } from '../../../environments/environment';

/**
 * A service for global logs.
 *
 * @author Damien Vitrac
 */
@Injectable()
export class LoggerService {

  constructor() {
  }

  static log(value: any, ...rest: any[]) {
    if (!environment.production) {
      console.log(value, ...rest);
    }
  }

  static error(value: any, ...rest: any[]) {
    console.error(value, ...rest);
  }

  static warn(value: any, ...rest: any[]) {
    console.warn(value, ...rest);
  }

  log(value: any, ...rest: any[]) {
    LoggerService.log(value, ...rest);
  }

  error(value: any, ...rest: any[]) {
    LoggerService.error(value, ...rest);
  }

  warn(value: any, ...rest: any[]) {
    LoggerService.warn(value, ...rest);
  }
}

results matching ""

    No results matching ""