refactor: Update Frontend logger function to enhance logging conditions

- Modified the logger function to check for logger enablement and development environment more robustly.
- Adjusted the condition to ensure logging occurs only when the logger is enabled or when the environment variable for logger is not set in development mode.
This commit is contained in:
Danny Avila 2025-12-12 20:09:31 -05:00
parent 4d7e6b4a58
commit cd3b141e3c
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956

View file

@ -9,7 +9,7 @@ const createLogFunction = (
type?: 'log' | 'warn' | 'error' | 'info' | 'debug' | 'dir',
): LogFunction => {
return (...args: unknown[]) => {
if (isDevelopment || isLoggerEnabled) {
if (isLoggerEnabled || (import.meta.env.VITE_ENABLE_LOGGER == null && isDevelopment)) {
const tag = typeof args[0] === 'string' ? args[0] : '';
if (shouldLog(tag)) {
if (tag && typeof args[1] === 'string' && type === 'error') {