Closed
Description
Suggestion
Splitting out of #5834 (comment):
in an ideal world we'd actually do a unique substring per file to help differentiate where logs are coming from.
eg
typescript-eslint:typescript-estree:inferSingleRun
,typescript-eslint:typescript-estree:create-program:useProvidedPrograms
, etcthis also allows you to easily filter the log lines to specific usecases with env vars like
DEBUG=typescript-eslint:typescript-estree:create-program:*
also helpful because
debug
also colours each string differently IIRC so it's easy to see different sources when parsing logs.I wonder if we can automate creation of the string via like
const PACKAGE_ROOT = "resolve from disk somehow"; function getLogger(filename: string) { const relative = path.relative(PACKAGE_ROOT, filename); const parsed = path.parse(relative); return debug(`typescript-eslint:${parsed.dir.replace(/\//g, ':')}:${parsed.name}`); } // then call this via const log = getLogger(__filename);
It'd be nifty if we could use a lint rule that enforces such a thing.