import { Injectable, isDevMode } from '@angular/core';

/**
 * A service for global logs.
 *
 * @author Damien Vitrac
 */
@Injectable({
  providedIn: 'root'
})
export class LoggerService {

  constructor() {
  }

  static log(value: any, ...rest: any[]) {
    if (isDevMode()) {
      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);
  }
}

import { Injectable } from '@angular/core';
import { environment } from '../../../environments/environment';

/**
 * A service for global logs.
 *
 * @author Damien Vitrac
 */
@Injectable({
  providedIn: 'root'
})
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);
  }
}

--- 
+++ 
@@ -1,5 +1,4 @@
-import { Injectable } from '@angular/core';
-import { environment } from '../../../environments/environment';
+import { Injectable, isDevMode } from '@angular/core';
 
 /**
  * A service for global logs.
@@ -15,7 +14,7 @@
   }
 
   static log(value: any, ...rest: any[]) {
-    if (!environment.production) {
+    if (isDevMode()) {
       console.log(value, ...rest);
     }
   }
Use isDevMode() instead of environment
