Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Commit

Permalink
[Logging] - Only hide logs in production and ens environments (#2567)
Browse files Browse the repository at this point in the history
* handle environments and logging

- production and ens

* polyfill path

Co-authored-by: Leandro Boscariol <[email protected]>

* staging check

Co-authored-by: Leandro Boscariol <[email protected]>
  • Loading branch information
W3stside and alfetopito authored Mar 23, 2022
1 parent 9444aa3 commit 2f9d905
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'polyfill-object.fromentries'

import flat from 'array.prototype.flat'
import flatMap from 'array.prototype.flatmap'
import { isEns, isProd, isStaging } from 'utils/environments'

flat.shim()
flatMap.shim()
Expand All @@ -10,7 +11,8 @@ const originalConsole = window.console
// define a new console
const proxiedConsole = new Proxy(window.console, {
get(obj, prop: keyof Console) {
if (process.env.NODE_ENV !== 'production') {
// show logs in all environments EXCEPT production & ens
if (!isProd || !isEns || !isStaging) {
return obj[prop]
} else {
return () => undefined
Expand Down

0 comments on commit 2f9d905

Please sign in to comment.