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 = () => { }.


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

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

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


import './log'

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