UNPKG

@carbon/ibm-products

Version:

Carbon for IBM Products

36 lines (32 loc) 931 B
/** * Copyright IBM Corp. 2020, 2025 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. */ // Copyright IBM Corp. 2020, 2021 // // This source code is licensed under the Apache-2.0 license found in the // LICENSE file in the root directory of this source tree. // const isProduction = process.env.NODE_ENV === 'production'; const noop = () => undefined; const shimIfProduction = fn => isProduction ? noop : fn; const log = shimIfProduction(function () { return console.log(...arguments); }); const warn = shimIfProduction(function () { return console.warn(...arguments); }); const error = shimIfProduction(function () { return console.error(...arguments); }); var pconsole = { isProduction, noop, shimIfProduction, log, warn, error }; export { pconsole as default, error, isProduction, log, noop, shimIfProduction, warn };