Skip to content

Commit

Permalink
feat: respect logger=false in environment variables (#838)
Browse files Browse the repository at this point in the history
  • Loading branch information
chanceaclark committed May 1, 2024
1 parent c740cdd commit 7a0e393
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/rude-dodos-collect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bigcommerce/catalyst-core": patch
---

Respects when `CLIENT_LOGGER="false"` or `KV_LOGGER="false"` is set in .env.local regardless of environment.
4 changes: 3 additions & 1 deletion apps/core/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ export const client = createClient({
storeHash: process.env.BIGCOMMERCE_STORE_HASH ?? '',
channelId: process.env.BIGCOMMERCE_CHANNEL_ID,
backendUserAgentExtensions: backendUserAgent,
logger: process.env.NODE_ENV !== 'production' || process.env.CLIENT_LOGGER === 'true',
logger:
(process.env.NODE_ENV !== 'production' && process.env.CLIENT_LOGGER !== 'false') ||
process.env.CLIENT_LOGGER === 'true',
});
4 changes: 3 additions & 1 deletion apps/core/lib/kv/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ async function createKVAdapter() {
}

const adapterInstance = new KV(createKVAdapter, {
logger: process.env.NODE_ENV !== 'production' || process.env.KV_LOGGER === 'true',
logger:
(process.env.NODE_ENV !== 'production' && process.env.KV_LOGGER !== 'false') ||
process.env.KV_LOGGER === 'true',
});

export { adapterInstance as kv };

0 comments on commit 7a0e393

Please sign in to comment.