From 15dddbe9e454bb22492ac70bbba1dcb568138014 Mon Sep 17 00:00:00 2001 From: Marc Bernard <59966492+mbtools@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:00:08 -0500 Subject: [PATCH] chore(logger): avoid message if level remains the same (#4991) --- .changeset/clean-beds-wash.md | 5 +++++ packages/logger/logger-commons/src/logger.ts | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/clean-beds-wash.md diff --git a/.changeset/clean-beds-wash.md b/.changeset/clean-beds-wash.md new file mode 100644 index 000000000..3bbebc4d7 --- /dev/null +++ b/.changeset/clean-beds-wash.md @@ -0,0 +1,5 @@ +--- +'@verdaccio/logger-commons': patch +--- + +chore(logger): avoid message if level remains the same diff --git a/packages/logger/logger-commons/src/logger.ts b/packages/logger/logger-commons/src/logger.ts index 85bf409fd..e1f99594f 100644 --- a/packages/logger/logger-commons/src/logger.ts +++ b/packages/logger/logger-commons/src/logger.ts @@ -93,7 +93,10 @@ export function createLogger( /* eslint-disable */ /* istanbul ignore next */ if (process.env.DEBUG) { - logger.on('level-change', (lvl, val, prevLvl, prevVal) => { + logger.on('level-change', (lvl, val, prevLvl, prevVal, instance) => { + if (logger !== instance) { + return; + } debug('%s (%d) was changed to %s (%d)', lvl, val, prevLvl, prevVal); }); }