From ffb2d887dc3e834f064ae3b61cbfe2dda18ff1ed Mon Sep 17 00:00:00 2001 From: Shivanee Persaud Date: Fri, 23 Oct 2026 13:47:31 -0700 Subject: [PATCH 1/2] fix(logging-utils): export LogSeverity as value and treat 'true' as '*' alias --- core/packages/logging-utils/src/index.ts | 8 ++--- .../logging-utils/src/logging-utils.ts | 2 +- .../logging-utils/test/logging-utils.ts | 30 ++++++++++++++++++- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/core/packages/logging-utils/src/index.ts b/core/packages/logging-utils/src/index.ts index 7005fa17925b..c718daa654c3 100644 --- a/core/packages/logging-utils/src/index.ts +++ b/core/packages/logging-utils/src/index.ts @@ -14,9 +14,5 @@ export * from './logging-utils'; // 🌟 ADDED EXPORT FOR TYPES 🌟 -export type { - LogFields, - LogSeverity, - AdhocDebugLogFunction, - DebugLogBackend, -} from './types'; +export {LogSeverity} from './types'; +export type {LogFields, AdhocDebugLogFunction, DebugLogBackend} from './types'; diff --git a/core/packages/logging-utils/src/logging-utils.ts b/core/packages/logging-utils/src/logging-utils.ts index 43b3cc7643fa..542b88b324cd 100644 --- a/core/packages/logging-utils/src/logging-utils.ts +++ b/core/packages/logging-utils/src/logging-utils.ts @@ -123,7 +123,7 @@ export abstract class DebugLogBackendBase implements DebugLogBackend { // Look for the Node config variable for what systems to enable. We'll store // these for the log method below, which will call setFilters() once. let nodeFlag = process.env[env.nodeEnables] ?? '*'; - if (nodeFlag === 'all') { + if (nodeFlag === 'all' || nodeFlag === 'true') { nodeFlag = '*'; } this.filters = nodeFlag.split(','); diff --git a/core/packages/logging-utils/test/logging-utils.ts b/core/packages/logging-utils/test/logging-utils.ts index 6f8314e72dfc..5f585e982f5f 100644 --- a/core/packages/logging-utils/test/logging-utils.ts +++ b/core/packages/logging-utils/test/logging-utils.ts @@ -16,7 +16,7 @@ import {describe, it} from 'mocha'; import * as assert from 'assert'; import * as sinon from 'sinon'; -import * as al from '../src/logging-utils'; +import * as al from '../src/index'; import * as alTypes from '../src/types'; interface TestLog { @@ -61,6 +61,26 @@ describe('adhoc-logging', () => { sink.reset(); process.env[al.env.nodeEnables] = 'all'; + const backend = new TestSink(); + assert.deepStrictEqual(backend.filters, ['*']); + const logger = al.log(system); + logger({}, 'foo'); + assert.deepStrictEqual(sink.logs, [ + { + namespace: system, + fields: {}, + args: ['foo'], + }, + ]); + }); + + it('obeys "true" as an alias for "*"', () => { + al.setBackend(sink); + sink.reset(); + + process.env[al.env.nodeEnables] = 'true'; + const backend = new TestSink(); + assert.deepStrictEqual(backend.filters, ['*']); const logger = al.log(system); logger({}, 'foo'); assert.deepStrictEqual(sink.logs, [ @@ -297,4 +317,12 @@ describe('adhoc-logging', () => { ]); }); }); + + it('exports LogSeverity as a runtime enum from index', () => { + assert.strictEqual(al.LogSeverity.DEFAULT, 'DEFAULT'); + assert.strictEqual(al.LogSeverity.DEBUG, 'DEBUG'); + assert.strictEqual(al.LogSeverity.INFO, 'INFO'); + assert.strictEqual(al.LogSeverity.WARNING, 'WARNING'); + assert.strictEqual(al.LogSeverity.ERROR, 'ERROR'); + }); }); From a02321040330864721c22947633a22283ab50c9c Mon Sep 17 00:00:00 2001 From: Shivanee Persaud Date: Fri, 23 Oct 2026 13:55:00 -0700 Subject: [PATCH 2/2] test(logging-utils): set active backend after updating process.env in alias tests --- core/packages/logging-utils/test/logging-utils.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/core/packages/logging-utils/test/logging-utils.ts b/core/packages/logging-utils/test/logging-utils.ts index 5f585e982f5f..886083b70b87 100644 --- a/core/packages/logging-utils/test/logging-utils.ts +++ b/core/packages/logging-utils/test/logging-utils.ts @@ -57,15 +57,13 @@ describe('adhoc-logging', () => { }); it('obeys "all" as an alias for "*"', () => { - al.setBackend(sink); - sink.reset(); - process.env[al.env.nodeEnables] = 'all'; const backend = new TestSink(); + al.setBackend(backend); assert.deepStrictEqual(backend.filters, ['*']); const logger = al.log(system); logger({}, 'foo'); - assert.deepStrictEqual(sink.logs, [ + assert.deepStrictEqual(backend.logs, [ { namespace: system, fields: {}, @@ -75,15 +73,13 @@ describe('adhoc-logging', () => { }); it('obeys "true" as an alias for "*"', () => { - al.setBackend(sink); - sink.reset(); - process.env[al.env.nodeEnables] = 'true'; const backend = new TestSink(); + al.setBackend(backend); assert.deepStrictEqual(backend.filters, ['*']); const logger = al.log(system); logger({}, 'foo'); - assert.deepStrictEqual(sink.logs, [ + assert.deepStrictEqual(backend.logs, [ { namespace: system, fields: {},