What should I do in order not to print to the console what the console.log method prints during production?

Is it related to class Logger?

@wenqi If you just want to prevent anything from getting logged with consoloe.log, you can just override it console.log = () => { }.

log.ts

 window.enableLog = function (value) {
    sessionStorage.setItem('enableLog', value);
  }

  const enable = sessionStorage.getItem('enableLog');


  console.log = (function (oriLogFunc) {
    return function () {
      if (enable === 'true') {
        try{
          oriLogFunc.call(console, ...arguments);
        }catch(e){
          console.error('console.log error', e);
        }
      }
    }
})(console.log);

frontend-module.ts

import './log'

I wrote it like this, but it will be overwritten by Logger.log