diff --git a/packages/internal/test-util/src/lib/error-throwing-driver/error-throwing.driver.spec.ts b/packages/internal/test-util/src/lib/error-throwing-driver/error-throwing.driver.spec.ts index 6a9b7d63..2177ffb1 100644 --- a/packages/internal/test-util/src/lib/error-throwing-driver/error-throwing.driver.spec.ts +++ b/packages/internal/test-util/src/lib/error-throwing-driver/error-throwing.driver.spec.ts @@ -1,8 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { - LogLevel, - LumberjackLevel, LumberjackLogDriver, LumberjackLogDriverLog, lumberjackLogDriverToken, @@ -33,26 +31,20 @@ describe(ErrorThrowingDriver.name, () => { } describe.each([ - [LumberjackLevel.Critical, (driver) => driver.logCritical], - [LumberjackLevel.Debug, (driver) => driver.logDebug], - [LumberjackLevel.Error, (driver) => driver.logError], - [LumberjackLevel.Info, (driver) => driver.logInfo], - [LumberjackLevel.Trace, (driver) => driver.logTrace], - [LumberjackLevel.Warning, (driver) => driver.logWarning], ['critical', (driver) => driver.logCritical], ['debug', (driver) => driver.logDebug], ['error', (driver) => driver.logError], ['info', (driver) => driver.logInfo], ['trace', (driver) => driver.logTrace], ['warn', (driver) => driver.logWarning], - ] as ReadonlyArray<[LumberjackLogLevel | LogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( + ] as ReadonlyArray<[LumberjackLogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( `implements a spy when using the %s log level`, (logLevel, logMethod) => { it('throws an error on first log when the default log driver configuration is used', () => { const { driver } = setup(); const driverLog = createDriverLog(logLevel, logLevel, '', 'ErrorThrowingDriverDefaultTest'); - expect(() => logMethod(driver).call(driver, driverLog)).toThrowError(); + expect(() => logMethod(driver).call(driver, driverLog)).toThrow(); }); describe.each([0, 1, 2, 3])( @@ -64,7 +56,7 @@ describe(ErrorThrowingDriver.name, () => { const act = () => logMethod(driver).call(driver, driverLog); repeatSideEffect(logsBeforeThrowing, act); - expect(act).toThrowError(); + expect(act).toThrow(); }); } ); diff --git a/packages/internal/test-util/src/lib/logs/driver-log-creators.ts b/packages/internal/test-util/src/lib/logs/driver-log-creators.ts index 72e420da..553dc29a 100644 --- a/packages/internal/test-util/src/lib/logs/driver-log-creators.ts +++ b/packages/internal/test-util/src/lib/logs/driver-log-creators.ts @@ -1,7 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { - LogLevel, LumberjackLogDriverLog, LumberjackLogLevel, LumberjackLogPayload, @@ -10,7 +9,7 @@ import { export const createDriverLog = ( formattedLog: string, - level: LumberjackLogLevel | LogLevel, + level: LumberjackLogLevel, message = '', scope = 'Test', payload?: TPayload diff --git a/packages/internal/test-util/src/lib/object-driver/object.driver.spec.ts b/packages/internal/test-util/src/lib/object-driver/object.driver.spec.ts index b77dc32c..eadc49fa 100644 --- a/packages/internal/test-util/src/lib/object-driver/object.driver.spec.ts +++ b/packages/internal/test-util/src/lib/object-driver/object.driver.spec.ts @@ -2,8 +2,6 @@ import { TestBed } from '@angular/core/testing'; import { createDriverLog, provideObjectDriver } from '@internal/test-util'; import { - LogLevel, - LumberjackLevel, LumberjackLogDriver, LumberjackLogDriverLog, lumberjackLogDriverToken, @@ -30,19 +28,13 @@ describe(ObjectDriver.name, () => { }); describe.each([ - [LumberjackLevel.Critical, (driver) => driver.logCritical, { isWorking: true }], - [LumberjackLevel.Debug, (driver) => driver.logDebug, { isWorking: false }], - [LumberjackLevel.Error, (driver) => driver.logError, undefined], - [LumberjackLevel.Info, (driver) => driver.logInfo, { isWorking: true }], - [LumberjackLevel.Trace, (driver) => driver.logTrace, { isWorking: false }], - [LumberjackLevel.Warning, (driver) => driver.logWarning, undefined], ['critical', (driver) => driver.logCritical, { isWorking: true }], ['debug', (driver) => driver.logDebug, { isWorking: false }], ['error', (driver) => driver.logError, undefined], ['info', (driver) => driver.logInfo, { isWorking: true }], ['trace', (driver) => driver.logTrace, { isWorking: false }], ['warn', (driver) => driver.logWarning, undefined], - ] as ReadonlyArray<[LumberjackLogLevel | LogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void, ObjectPayload | undefined]>)( + ] as ReadonlyArray<[LumberjackLogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void, ObjectPayload | undefined]>)( `delegates to ${ObjectService.name} when using the %s log level`, (logLevel, logMethod, expectedPayload) => { it(`forwards the log payload to the ${ObjectService.prototype.log.name} method`, () => { diff --git a/packages/internal/test-util/src/lib/spy-driver/spy.driver.spec.ts b/packages/internal/test-util/src/lib/spy-driver/spy.driver.spec.ts index 1593c4f1..c863cfff 100644 --- a/packages/internal/test-util/src/lib/spy-driver/spy.driver.spec.ts +++ b/packages/internal/test-util/src/lib/spy-driver/spy.driver.spec.ts @@ -1,8 +1,6 @@ import { TestBed } from '@angular/core/testing'; import { - LogLevel, - LumberjackLevel, LumberjackLogDriver, LumberjackLogDriverLog, lumberjackLogDriverToken, @@ -27,19 +25,13 @@ describe(SpyDriver.name, () => { }); describe.each([ - [LumberjackLevel.Critical, (driver) => driver.logCritical], - [LumberjackLevel.Debug, (driver) => driver.logDebug], - [LumberjackLevel.Error, (driver) => driver.logError], - [LumberjackLevel.Info, (driver) => driver.logInfo], - [LumberjackLevel.Trace, (driver) => driver.logTrace], - [LumberjackLevel.Warning, (driver) => driver.logWarning], ['critical', (driver) => driver.logCritical], ['debug', (driver) => driver.logDebug], ['error', (driver) => driver.logError], ['info', (driver) => driver.logInfo], ['trace', (driver) => driver.logTrace], ['warn', (driver) => driver.logWarning], - ] as ReadonlyArray<[LumberjackLogLevel | LogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( + ] as ReadonlyArray<[LumberjackLogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( `implements a spy when using the %s log level`, (logLevel, logMethod) => { it('records calls', () => { diff --git a/packages/ngworker/lumberjack/http-driver/src/lib/configuration/provide-lumberjack-http-driver.spec.ts b/packages/ngworker/lumberjack/http-driver/src/lib/configuration/provide-lumberjack-http-driver.spec.ts index ae5bd4f2..13b9382a 100644 --- a/packages/ngworker/lumberjack/http-driver/src/lib/configuration/provide-lumberjack-http-driver.spec.ts +++ b/packages/ngworker/lumberjack/http-driver/src/lib/configuration/provide-lumberjack-http-driver.spec.ts @@ -2,7 +2,6 @@ import { TestBed } from '@angular/core/testing'; import { HttpHandlerFn, HttpRequest, withInterceptors } from '@angular/common/http'; import { - ConfigLevels, LumberjackConfigLevels, LumberjackLogDriver, lumberjackLogDriverToken, @@ -23,7 +22,7 @@ import { LumberjackHttpDriverInternalConfig } from './lumberjack-http-driver-int import { LumberjackHttpDriverOptions } from './lumberjack-http-driver.options'; function createHttpOptions( - extraOptions: { levels?: ConfigLevels; identifier?: string } = {} + extraOptions: { levels?: LumberjackConfigLevels; identifier?: string } = {} ): LumberjackHttpDriverOptions { return { origin: 'TEST_MODULE', @@ -33,10 +32,7 @@ function createHttpOptions( }; } -function createHttpConfig( - levels: LumberjackConfigLevels | ConfigLevels, - identifier?: string -): LumberjackHttpDriverConfig { +function createHttpConfig(levels: LumberjackConfigLevels, identifier?: string): LumberjackHttpDriverConfig { const config: Writable = { levels, origin: 'TEST_MODULE', @@ -169,7 +165,7 @@ describe(provideLumberjackHttpDriver.name, () => { }); it('registers the specified options with custom levels', () => { - const customLevels: ConfigLevels = ['critical']; + const customLevels: LumberjackConfigLevels = ['critical']; const options = createHttpOptions({ levels: customLevels }); const httpDriver = createHttpDriverWithOptions({ options }); @@ -228,7 +224,7 @@ describe(provideLumberjackHttpDriver.name, () => { it('does register the specified log driver options WITH HttpClient features', () => { const testInterceptor = jest.fn((req, next) => next(req)); const features: HttpClientFeatures = [withInterceptors([testInterceptor])]; - const customLevels: ConfigLevels = ['critical']; + const customLevels: LumberjackConfigLevels = ['critical']; const options = createHttpOptions({ levels: customLevels }); const httpDriver = createHttpDriverWithOptions({ options, features }); diff --git a/packages/ngworker/lumberjack/http-driver/src/lib/log-drivers/lumberjack-http.driver.spec.ts b/packages/ngworker/lumberjack/http-driver/src/lib/log-drivers/lumberjack-http.driver.spec.ts index f6776622..f810703e 100644 --- a/packages/ngworker/lumberjack/http-driver/src/lib/log-drivers/lumberjack-http.driver.spec.ts +++ b/packages/ngworker/lumberjack/http-driver/src/lib/log-drivers/lumberjack-http.driver.spec.ts @@ -4,8 +4,6 @@ import { VERSION } from '@angular/platform-browser'; import { createCriticalDriverLog, createDriverLog, repeatSideEffect } from '@internal/test-util'; import { - LogLevel, - LumberjackLevel, LumberjackLogDriver, LumberjackLogDriverLog, lumberjackLogDriverToken, @@ -104,19 +102,13 @@ describe(LumberjackHttpDriver.name, () => { }); describe.each([ - [LumberjackLevel.Critical, (driver) => driver.logCritical], - [LumberjackLevel.Debug, (driver) => driver.logDebug], - [LumberjackLevel.Error, (driver) => driver.logError], - [LumberjackLevel.Info, (driver) => driver.logInfo], - [LumberjackLevel.Trace, (driver) => driver.logTrace], - [LumberjackLevel.Warning, (driver) => driver.logWarning], ['critical', (driver) => driver.logCritical], ['debug', (driver) => driver.logDebug], ['error', (driver) => driver.logError], ['info', (driver) => driver.logInfo], ['trace', (driver) => driver.logTrace], ['warn', (driver) => driver.logWarning], - ] as ReadonlyArray<[LumberjackLogLevel | LogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( + ] as ReadonlyArray<[LumberjackLogLevel, (driver: LumberjackLogDriver) => (driverLog: LumberjackLogDriverLog) => void]>)( 'logs to a web API using the %s log level', (logLevel, logMethod) => { it('sends the driver log to the configured URL', () => { diff --git a/packages/ngworker/lumberjack/src/index.ts b/packages/ngworker/lumberjack/src/index.ts index 2637f903..87d0a33f 100644 --- a/packages/ngworker/lumberjack/src/index.ts +++ b/packages/ngworker/lumberjack/src/index.ts @@ -24,10 +24,10 @@ export { LumberjackLogFactory } from './lib/logging/lumberjack-log-factory'; export { LumberjackLogBuilder } from './lib/logging/lumberjack-log.builder'; // Logs -export { LumberjackConfigLevels, ConfigLevels } from './lib/logs/lumberjack-config-levels'; -export { LumberjackLevel, Level } from './lib/logs/lumberjack-level'; +export { LumberjackConfigLevels } from './lib/logs/lumberjack-config-levels'; +export { LumberjackLevel } from './lib/logs/lumberjack-level'; export { LumberjackLog } from './lib/logs/lumberjack.log'; -export { LumberjackLogLevel, LogLevel } from './lib/logs/lumberjack-log-level'; +export { LumberjackLogLevel } from './lib/logs/lumberjack-log-level'; export { LumberjackLogPayload } from './lib/logs/lumberjack-log-payload'; // Time diff --git a/packages/ngworker/lumberjack/src/lib/configuration/default-development-levels.ts b/packages/ngworker/lumberjack/src/lib/configuration/default-development-levels.ts index 1c5c5d2e..7abfed6a 100644 --- a/packages/ngworker/lumberjack/src/lib/configuration/default-development-levels.ts +++ b/packages/ngworker/lumberjack/src/lib/configuration/default-development-levels.ts @@ -1,3 +1,3 @@ -import { ConfigLevels, LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; +import { LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; -export const defaultDevelopmentLevels: LumberjackConfigLevels | ConfigLevels = ['verbose']; +export const defaultDevelopmentLevels: LumberjackConfigLevels = ['verbose']; diff --git a/packages/ngworker/lumberjack/src/lib/configuration/default-production-levels.ts b/packages/ngworker/lumberjack/src/lib/configuration/default-production-levels.ts index bd6d4f79..c3fa7117 100644 --- a/packages/ngworker/lumberjack/src/lib/configuration/default-production-levels.ts +++ b/packages/ngworker/lumberjack/src/lib/configuration/default-production-levels.ts @@ -1,3 +1,3 @@ -import { ConfigLevels, LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; +import { LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; -export const defaultProductionLevels: LumberjackConfigLevels | ConfigLevels = ['critical', 'error', 'info', 'warn']; +export const defaultProductionLevels: LumberjackConfigLevels = ['critical', 'error', 'info', 'warn']; diff --git a/packages/ngworker/lumberjack/src/lib/configuration/lumberjack-log-driver.config.ts b/packages/ngworker/lumberjack/src/lib/configuration/lumberjack-log-driver.config.ts index fd0aa5ad..96063863 100644 --- a/packages/ngworker/lumberjack/src/lib/configuration/lumberjack-log-driver.config.ts +++ b/packages/ngworker/lumberjack/src/lib/configuration/lumberjack-log-driver.config.ts @@ -1,4 +1,4 @@ -import { ConfigLevels, LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; +import { LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; /** * Settings for a log driver. @@ -9,7 +9,7 @@ export interface LumberjackLogDriverConfig { * * `['verbose']` indicates that all log levels are allowed. */ - readonly levels: LumberjackConfigLevels | ConfigLevels; + readonly levels: LumberjackConfigLevels; /** * Driver Identifier, necessary for driver filtering. diff --git a/packages/ngworker/lumberjack/src/lib/configuration/lumberjack.config.ts b/packages/ngworker/lumberjack/src/lib/configuration/lumberjack.config.ts index b4629955..e7a629ea 100644 --- a/packages/ngworker/lumberjack/src/lib/configuration/lumberjack.config.ts +++ b/packages/ngworker/lumberjack/src/lib/configuration/lumberjack.config.ts @@ -1,4 +1,4 @@ -import { ConfigLevels, LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; +import { LumberjackConfigLevels } from '../logs/lumberjack-config-levels'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackFormatFunction } from './lumberjack-format-function'; @@ -15,5 +15,5 @@ export interface LumberjackConfig { let logFactory: LumberjackLogFactory; describe('Log level', () => { - const logLevels: (LumberjackLogLevel | LogLevel)[] = [ - LumberjackLevel.Critical, - LumberjackLevel.Debug, - LumberjackLevel.Error, - LumberjackLevel.Info, - LumberjackLevel.Trace, - LumberjackLevel.Warning, - 'critical', - 'debug', - 'error', - 'info', - 'trace', - 'warn', - ]; + const logLevels: LumberjackLogLevel[] = ['critical', 'debug', 'error', 'info', 'trace', 'warn']; logLevels.forEach((expectedLevel) => { it(`prefixes the message with log level "${expectedLevel}"`, () => { @@ -78,7 +64,7 @@ describe(lumberjackFormatLog.name, () => { it('adds the 0 hours UTC offset with milliseconds resolution', () => { const log: LumberjackLog = { createdAt: unixEpochTicks, - level: LumberjackLevel.Debug, + level: 'debug', message: 'Timestamp test', scope: 'Timestamp', }; diff --git a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.spec.ts b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.spec.ts index 63d6546d..f1f47bf3 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.spec.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.spec.ts @@ -2,8 +2,7 @@ import { TestBed } from '@angular/core/testing'; import { FakeTimeService } from '@internal/test-util'; -import { LumberjackLevel } from '../logs/lumberjack-level'; -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackLog } from '../logs/lumberjack.log'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -14,12 +13,7 @@ interface TestPayload extends LumberjackLogPayload { testProperty: string; } -const lumberjackLogLevels: (LumberjackLogLevel | LogLevel)[] = [ - LumberjackLevel.Critical, - LumberjackLevel.Error, - 'critical', - 'error', -]; +const lumberjackLogLevels: LumberjackLogLevel[] = ['critical', 'error']; describe(LumberjackLogBuilder.name, () => { const testMessage = 'Test Message'; diff --git a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.ts b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.ts index 7bd3b042..ccc07da9 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-log.builder.ts @@ -1,4 +1,4 @@ -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackLog } from '../logs/lumberjack.log'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -18,7 +18,7 @@ export class LumberjackLogBuilder { const testMessage = 'Test Message'; diff --git a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.builder.ts b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.builder.ts index e00be83f..362d5499 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.builder.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.builder.ts @@ -1,4 +1,4 @@ -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -9,13 +9,13 @@ export class LumberjackLoggerBuilder; readonly #time: LumberjackTimeService; - readonly #level: LumberjackLogLevel | LogLevel; + readonly #level: LumberjackLogLevel; readonly #message: string; constructor( lumberjack: LumberjackService, time: LumberjackTimeService, - level: LumberjackLogLevel | LogLevel, + level: LumberjackLogLevel, message: string ) { this.#lumberjack = lumberjack; diff --git a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.service.ts b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.service.ts index d443ce11..2d25029b 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.service.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/lumberjack-logger.service.ts @@ -1,6 +1,6 @@ import { inject, Injectable } from '@angular/core'; -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -65,10 +65,7 @@ export abstract class LumberjackLogger { + protected createLoggerBuilder(level: LumberjackLogLevel, message: string): LumberjackLoggerBuilder { return new LumberjackLoggerBuilder(this.lumberjack, this.time, level, message); } } diff --git a/packages/ngworker/lumberjack/src/lib/logging/lumberjack.service.ts b/packages/ngworker/lumberjack/src/lib/logging/lumberjack.service.ts index b45886cd..4fd4430f 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/lumberjack.service.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/lumberjack.service.ts @@ -6,7 +6,7 @@ import { LumberjackLogDriver } from '../log-drivers/lumberjack-log-driver'; import { LumberjackLogDriverError } from '../log-drivers/lumberjack-log-driver-error'; import { LumberjackLogDriverLogger } from '../log-drivers/lumberjack-log-driver-logger'; import { lumberjackLogDriverToken } from '../log-drivers/lumberjack-log-driver.token'; -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackLog } from '../logs/lumberjack.log'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -167,9 +167,9 @@ export class LumberjackService, logLevel: LumberjackLogLevel | LogLevel): boolean { + #canDriveLog(driver: LumberjackLogDriver, logLevel: LumberjackLogLevel): boolean { const hasVerboseLogging = driver.config.levels.length === 1 && driver.config.levels[0] === 'verbose'; - const acceptsLogLevel = (driver.config.levels as (LumberjackLogLevel | LogLevel)[]).includes(logLevel); + const acceptsLogLevel = (driver.config.levels as LumberjackLogLevel[]).includes(logLevel); return hasVerboseLogging || acceptsLogLevel; } diff --git a/packages/ngworker/lumberjack/src/lib/logging/scoped-lumberjack-logger.service.ts b/packages/ngworker/lumberjack/src/lib/logging/scoped-lumberjack-logger.service.ts index 8c8e2ae9..9171d497 100644 --- a/packages/ngworker/lumberjack/src/lib/logging/scoped-lumberjack-logger.service.ts +++ b/packages/ngworker/lumberjack/src/lib/logging/scoped-lumberjack-logger.service.ts @@ -1,6 +1,6 @@ import { inject, Injectable } from '@angular/core'; -import { LogLevel, LumberjackLogLevel } from '../logs/lumberjack-log-level'; +import { LumberjackLogLevel } from '../logs/lumberjack-log-level'; import { LumberjackLogPayload } from '../logs/lumberjack-log-payload'; import { LumberjackTimeService } from '../time/lumberjack-time.service'; @@ -31,7 +31,7 @@ export abstract class ScopedLumberjackLogger< * specified log level and message. */ protected override createLoggerBuilder( - level: LumberjackLogLevel | LogLevel, + level: LumberjackLogLevel, message: string ): LumberjackLoggerBuilder { return new LumberjackLoggerBuilder(this.lumberjack, this.time, level, message).withScope(this.scope); diff --git a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-config-levels.ts b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-config-levels.ts index 85858440..ef6ca525 100644 --- a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-config-levels.ts +++ b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-config-levels.ts @@ -1,23 +1,13 @@ -import { Level, LumberjackLevel } from './lumberjack-level'; -import { LogLevel, LumberjackLogLevel } from './lumberjack-log-level'; +import { LumberjackLevel } from './lumberjack-level'; +import { LumberjackLogLevel } from './lumberjack-log-level'; /** * A set of Levels used to configure a log driver. Lumberjack filters logs * passed to the log driver based on its configured log levels. * - * @deprecated use `ConfigLevels` instead. Enums will be removed in Lumberjack 19 in favor of string literal types. - */ -export type LumberjackConfigLevels = LumberjackLogLevel[] | [LumberjackLevel.Verbose]; - -/** - * A set of Levels used to configure a log driver. Lumberjack filters logs - * passed to the log driver based on its configured log levels. - * - * We recommend aliasing `ConfigLevels` to `LumberjackConfigLevels`. This will be the final name after removing enum based levels. - * * @example * ```typescript - * import { ConfigLevels as LumberjackConfigLevels } from '@ngworker/lumberjack'; + * import { LumberjackConfigLevels } from '@ngworker/lumberjack'; * ``` */ -export type ConfigLevels = LogLevel[] | [Extract]; +export type LumberjackConfigLevels = LumberjackLogLevel[] | [Extract]; diff --git a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-level.ts b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-level.ts index 4c5d1a01..32c40cf4 100644 --- a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-level.ts +++ b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-level.ts @@ -1,27 +1,9 @@ /** * All supported levels supported by Lumberjack. Used to specify the severity of a log and to configure Lumberjack and the log drivers. * - * @deprecated use `Level` instead. Enums will be removed in Lumberjack 19 in favor of string literal types. - * - */ -export enum LumberjackLevel { - Critical = 'critical', - Debug = 'debug', - Error = 'error', - Info = 'info', - Trace = 'trace', - Verbose = 'verbose', - Warning = 'warn', -} - -/** - * All supported levels supported by Lumberjack. Used to specify the severity of a log and to configure Lumberjack and the log drivers. - * - * We recommend aliasing `Level` to `LumberjackLevel`. This will be the final name after removing enum based levels. - * * @example * ```typescript - * import { Level as LumberjackLevel } from '@ngworker/lumberjack'; + * import { LumberjackLevel } from '@ngworker/lumberjack'; * ``` */ -export type Level = 'critical' | 'debug' | 'error' | 'info' | 'trace' | 'verbose' | 'warn'; +export type LumberjackLevel = 'critical' | 'debug' | 'error' | 'info' | 'trace' | 'verbose' | 'warn'; diff --git a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-log-level.ts b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-log-level.ts index 942b1fa5..131b7033 100644 --- a/packages/ngworker/lumberjack/src/lib/logs/lumberjack-log-level.ts +++ b/packages/ngworker/lumberjack/src/lib/logs/lumberjack-log-level.ts @@ -1,20 +1,11 @@ -import { Level, LumberjackLevel } from './lumberjack-level'; +import { LumberjackLevel } from './lumberjack-level'; /** * Level used to represent severity of a log. * - * @deprecated use `LogLevel` instead. Enums will be removed in Lumberjack 19 in favor of string literal types. - */ -export type LumberjackLogLevel = Exclude; - -/** - * Level used to represent severity of a log. - * - * We recommend aliasing `LogLevel` to `LumberjackLogLevel`. This will be the final name after removing enum based levels. - * * @example * ```typescript - * import { LogLevel as LumberjackLogLevel } from '@ngworker/lumberjack'; + * import { LumberjackLogLevel } from '@ngworker/lumberjack'; * ``` */ -export type LogLevel = Exclude; +export type LumberjackLogLevel = Exclude; diff --git a/packages/ngworker/lumberjack/src/lib/logs/lumberjack.log.ts b/packages/ngworker/lumberjack/src/lib/logs/lumberjack.log.ts index e9944612..fa7b17b9 100644 --- a/packages/ngworker/lumberjack/src/lib/logs/lumberjack.log.ts +++ b/packages/ngworker/lumberjack/src/lib/logs/lumberjack.log.ts @@ -1,4 +1,4 @@ -import { LogLevel, LumberjackLogLevel } from './lumberjack-log-level'; +import { LumberjackLogLevel } from './lumberjack-log-level'; import { LumberjackLogPayload } from './lumberjack-log-payload'; /** @@ -12,7 +12,7 @@ export interface LumberjackLog { describe('Interfaces', () => { @@ -33,36 +22,10 @@ describe('Logs API', () => { expect(value).toBeDefined(); }); - it('exposes ConfigLevels', () => { - const value: ConfigLevels = []; - - expect(value).toBeDefined(); - }); - it('exposes LumberjackLogLevel', () => { const value: LumberjackLogLevel | undefined = undefined; expect(value).toBeUndefined(); }); - - it('exposes LogLevel', () => { - const value: LogLevel | undefined = undefined; - - expect(value).toBeUndefined(); - }); - - it('exposes Level', () => { - const value: Level | undefined = undefined; - - expect(value).toBeUndefined(); - }); - }); - - describe('Enums', () => { - it('exposes LumberjackLevel', () => { - const sut = LumberjackLevel; - - expect(isObject(sut)).toBeTruthy(); - }); }); });