Created
June 18, 2022 12:12
-
-
Save richtier/c738bd59efde3be9ac33b770d01505e1 to your computer and use it in GitHub Desktop.
nutmeg logging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Your client-side logging is turned on in prod. the logic I see is: | |
```js | |
const isDevEnv = () => { | |
return !!(global.NutmegConfig && global.NutmegConfig.ENVIRONMENT !== 'production'); | |
}; | |
export const logger = ({ interactionPath, properties }, subst = 'info') => { | |
if (isDevEnv()) { | |
// do the logging | |
} | |
} | |
``` | |
but `isDevEnv` returns `true` in production because the value of `global.NutmegConfig.ENVIRONMENT` is `'prod'` rather than `'production'`. | |
Note you will need to replace `global` with `window` to read it aka `window.NutmegConfig.ENVIRONMENT` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment