Skip to content

Instantly share code, notes, and snippets.

@richtier
Created June 18, 2022 12:12
Show Gist options
  • Save richtier/c738bd59efde3be9ac33b770d01505e1 to your computer and use it in GitHub Desktop.
Save richtier/c738bd59efde3be9ac33b770d01505e1 to your computer and use it in GitHub Desktop.
nutmeg logging
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