Skip to content

Commit

Permalink
fix PUBLIC_LOG_LEVEL env var usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanatkn committed Sep 21, 2023
1 parent db08052 commit 286aa46
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-ways-own.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@grogarden/util': patch
---

fix PUBLIC_LOG_LEVEL env var usage
6 changes: 4 additions & 2 deletions src/lib/log.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {red, yellow, gray, black, magenta, bgYellow, bgRed} from 'kleur/colors';
import {PUBLIC_LOG_LEVEL} from '$env/static/public';

import {EMPTY_ARRAY, toArray} from './array.js';

Expand Down Expand Up @@ -39,7 +38,10 @@ export const configureLogLevel = (
}
};

const DEFAULT_LOG_LEVEL: LogLevel = (PUBLIC_LOG_LEVEL as LogLevel) ?? 'info';
const DEFAULT_LOG_LEVEL: LogLevel =
// eslint-disable-next-line @typescript-eslint/prefer-optional-chain
(typeof process !== 'undefined' && (process.env?.PUBLIC_LOG_LEVEL as LogLevel | undefined)) ||
'info';

/*
Expand Down

0 comments on commit 286aa46

Please sign in to comment.