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..886083b70b87 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 { @@ -57,13 +57,29 @@ 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: {}, + args: ['foo'], + }, + ]); + }); + + it('obeys "true" as an alias for "*"', () => { + 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(backend.logs, [ { namespace: system, fields: {}, @@ -297,4 +313,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'); + }); });