Skip to content

Commit fd3ad98

Browse files
pkiparraMalteSehmer
andcommitted
💥 enforce apiKey parameters for loggers
Co-Authored-By: Malte Sehmer <[email protected]>
1 parent c429632 commit fd3ad98

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

‎src/models/controller.model.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export class Controller {
9696
const raceResult = await Promise.race([fetcherPromise, timeoutPromise]);
9797
if (raceResult === "TIMEOUT") {
9898
infoLogger(
99+
"getContacts",
99100
`Fetching too slow, returning empty array.`,
100101
providerConfig.apiKey
101102
);

‎src/util/error.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { errorLogger } from "./logger.util";
99
export const throwAndDelegateError = (
1010
error: Error | AxiosError,
1111
source: string,
12-
apiKey?: string,
12+
apiKey: string | undefined,
1313
logMessage?: string
1414
) => {
1515
const errorMessage =

‎src/util/logger.util.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { anonymizeKey } from "./anonymize-key";
1010
export const infoLogger = (
1111
source: string,
1212
message: string,
13-
apiKey?: string,
13+
apiKey: string | undefined,
1414
...args: unknown[]
1515
): void => {
1616
logger(console.info, source, message, apiKey, args);
@@ -26,7 +26,7 @@ export const infoLogger = (
2626
export const errorLogger = (
2727
source: string,
2828
message: string,
29-
apiKey?: string,
29+
apiKey: string | undefined,
3030
...args: unknown[]
3131
): void => {
3232
logger(console.error, source, message, apiKey, args);
@@ -52,7 +52,7 @@ const logger = (
5252
logFn: (message?: any, ...optionalParams: any[]) => void,
5353
source: string,
5454
message: string,
55-
apiKey?: string,
55+
apiKey: string | undefined,
5656
...args: unknown[]
5757
): void => {
5858
// eslint-disable-next-line no-console

0 commit comments

Comments
 (0)