debug icon indicating copy to clipboard operation
debug copied to clipboard

env variable DEBUG is not parsed correctly

Open zymon opened this issue 11 months ago • 0 comments

If the DEBUG env variable contains multiple items separated with spaces, then only the first one is used.

For example: export DEBUG="APP_X APP_Y APP_Z"

Then, only the APP_X is enabled for debugging. Other apps are ignored. This is due to the way the string is parsed:

In debug\src\common.js, line 169:

const split = (typeof namespaces === 'string' ? namespaces : '') .trim() .replace(' ', ',') .split(',') .filter(Boolean);

replace('', ',') changes only the first occurrence of space

So, to fix it you can use regexp:

const split = (typeof namespaces === 'string' ? namespaces : '') .trim() .replace(/ /g, ',') .split(',') .filter(Boolean);

zymon avatar Jan 16 '25 16:01 zymon