diff --git a/.changeset/bright-trees-rush.md b/.changeset/bright-trees-rush.md new file mode 100644 index 0000000..523cce3 --- /dev/null +++ b/.changeset/bright-trees-rush.md @@ -0,0 +1,9 @@ +--- +"loglayer": minor +--- + +Fix ILogLayer return types + +`ILogLayer#withPrefix()` and `ILogLayer#withChild()` were of the incorrect return type. + +Changed to `ILogLayer`. diff --git a/README.md b/README.md index a252838..9d901fb 100755 --- a/README.md +++ b/README.md @@ -589,7 +589,7 @@ The same log commands would now be formatted as: ### Child logger -`LogLayer#child()` +`LogLayer#child(): LogLayer` You can create a child logger, which will copy the configuration you used for creating the parent, along with the existing context data and plugins. diff --git a/package-lock.json b/package-lock.json index e881ab1..99a33fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "loglayer", - "version": "4.3.2", + "version": "4.3.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "loglayer", - "version": "4.3.2", + "version": "4.3.3", "license": "MIT", "devDependencies": { "@biomejs/biome": "^1.6.4", diff --git a/src/MockLogLayer.ts b/src/MockLogLayer.ts index 4884619..b8fa571 100644 --- a/src/MockLogLayer.ts +++ b/src/MockLogLayer.ts @@ -3,7 +3,7 @@ import { MockLogBuilder } from "./MockLogBuilder"; import type { ErrorOnlyOpts, ILogBuilder, ILogLayer, LogLayerPlugin } from "./types"; -import type { LogLevel, MessageDataType } from "./types/common.types"; +import type { LogLevel, MessageDataType } from "./types"; export class MockLogLayer implements ILogLayer { info(...messages: MessageDataType[]): void {} @@ -28,11 +28,11 @@ export class MockLogLayer implements ILogLayer; } withContext(context: Record): ILogLayer { - return this; + return this as ILogLayer; } withError(error: ErrorType): ILogBuilder { @@ -56,7 +56,7 @@ export class MockLogLayer implements ILogLayer; } muteContext() { diff --git a/src/types/index.ts b/src/types/index.ts index 8c20bfd..c76d0da 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -67,7 +67,7 @@ export interface ILogLayer; /** * Appends context data which will be included with * every log entry. @@ -106,7 +106,7 @@ export interface ILogLayer; /** * Disables inclusion of context data in the print