Skip to content

Commit 1671055

Browse files
committed
chore: improve types
1 parent cb63fbb commit 1671055

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/logger/src/types/Logger.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,14 @@ type PersistentKeysOption = {
108108
/**
109109
* Keys that will be added to all log items.
110110
*/
111-
persistentKeys?: LogAttributes;
111+
persistentKeys?: LogAttributes & {
112+
message?: never;
113+
level?: never;
114+
sampling_rate?: never;
115+
service?: never;
116+
timestamp?: never;
117+
error?: never;
118+
};
112119
/**
113120
* @deprecated Use `persistentKeys` instead.
114121
*/

packages/logger/tests/unit/workingWithkeys.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ describe('Working with keys', () => {
675675
// Prepare
676676
const logger = new Logger({
677677
persistentKeys: {
678+
// @ts-expect-error - testing invalid key at runtime
678679
sampling_rate: 'Hello, World!',
679680
},
680681
});

0 commit comments

Comments
 (0)