Skip to content

Commit 25c8d72

Browse files
committed
Consistency
1 parent b7ba36c commit 25c8d72

10 files changed

Lines changed: 20 additions & 11 deletions

File tree

lambdas/authorizer/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"@aws-sdk/client-dynamodb": "^3.858.0",
44
"@aws-sdk/lib-dynamodb": "^3.858.0",
55
"@internal/datastore": "*",
6+
"@internal/helpers": "*",
67
"aws-lambda": "^1.0.7",
78
"esbuild": "^0.25.11",
89
"pino": "^9.7.0",

lambdas/authorizer/src/deps.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
22
import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
3-
import pino from "pino";
3+
import { Logger } from "pino";
44
import { SupplierRepository } from "@internal/datastore";
5+
import { createLogger } from "@internal/helpers/src";
56
import { EnvVars, envVars } from "./env";
67

78
export type Deps = {
89
supplierRepo: SupplierRepository;
9-
logger: pino.Logger;
10+
logger: Logger;
1011
env: EnvVars;
1112
};
1213

@@ -17,7 +18,7 @@ function createDocumentClient(): DynamoDBDocumentClient {
1718

1819
function createSupplierRepository(
1920
documentClient: DynamoDBDocumentClient,
20-
log: pino.Logger,
21+
log: Logger,
2122
suppliersTableName: string,
2223
): SupplierRepository {
2324
const config = {
@@ -28,7 +29,7 @@ function createSupplierRepository(
2829
}
2930

3031
export function createDependenciesContainer(): Deps {
31-
const log = pino();
32+
const log = createLogger({ logLevel: envVars.PINO_LOG_LEVEL });
3233

3334
return {
3435
supplierRepo: createSupplierRepository(

lambdas/authorizer/src/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const EnvVarsSchema = z.object({
55
CLOUDWATCH_NAMESPACE: z.string(),
66
APIM_SUPPLIER_ID_HEADER: z.string(),
77
CLIENT_CERTIFICATE_EXPIRATION_ALERT_DAYS: z.coerce.number().int(),
8+
PINO_LOG_LEVEL: z.coerce.string().optional(),
89
});
910

1011
export type EnvVars = z.infer<typeof EnvVarsSchema>;

lambdas/letter-updates-transformer/src/deps.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import pino from "pino";
1+
import { Logger } from "pino";
22
import { SNSClient } from "@aws-sdk/client-sns";
3+
import { createLogger } from "@internal/helpers/src";
34
import { EnvVars, envVars } from "./env";
45

56
export type Deps = {
67
snsClient: SNSClient;
7-
logger: pino.Logger;
8+
logger: Logger;
89
env: EnvVars;
910
};
1011

@@ -13,7 +14,7 @@ function createSNSClient(): SNSClient {
1314
}
1415

1516
export function createDependenciesContainer(): Deps {
16-
const log = pino();
17+
const log = createLogger({ logLevel: envVars.PINO_LOG_LEVEL });
1718

1819
return {
1920
snsClient: createSNSClient(),

lambdas/letter-updates-transformer/src/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { z } from "zod";
33
const EnvVarsSchema = z.object({
44
EVENTPUB_SNS_TOPIC_ARN: z.string(),
55
EVENT_SOURCE: z.string(),
6+
PINO_LOG_LEVEL: z.coerce.string().optional(),
67
});
78

89
export type EnvVars = z.infer<typeof EnvVarsSchema>;

lambdas/mi-updates-transformer/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"@aws-sdk/client-sns": "^3.954.0",
44
"@aws-sdk/util-dynamodb": "^3.943.0",
55
"@internal/datastore": "^0.1.0",
6+
"@internal/helpers": "*",
67
"@nhsdigital/nhs-notify-event-schemas-supplier-api": "*",
78
"aws-lambda": "^1.0.7",
89
"esbuild": "^0.24.0",

lambdas/mi-updates-transformer/src/deps.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import pino from "pino";
1+
import { Logger } from "pino";
22
import { SNSClient } from "@aws-sdk/client-sns";
3+
import { createLogger } from "@internal/helpers/src";
34
import { EnvVars, envVars } from "./env";
45

56
export type Deps = {
67
snsClient: SNSClient;
7-
logger: pino.Logger;
8+
logger: Logger;
89
env: EnvVars;
910
};
1011

@@ -13,7 +14,7 @@ function createSNSClient(): SNSClient {
1314
}
1415

1516
export function createDependenciesContainer(): Deps {
16-
const log = pino();
17+
const log = createLogger({ logLevel: envVars.PINO_LOG_LEVEL });
1718

1819
return {
1920
snsClient: createSNSClient(),

lambdas/mi-updates-transformer/src/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { z } from "zod";
22

33
const EnvVarsSchema = z.object({
44
EVENTPUB_SNS_TOPIC_ARN: z.string(),
5+
PINO_LOG_LEVEL: z.coerce.string().optional(),
56
});
67

78
export type EnvVars = z.infer<typeof EnvVarsSchema>;

lambdas/upsert-letter/src/config/deps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function createLetterRepository(
3030
}
3131

3232
export function createDependenciesContainer(): Deps {
33-
const log = createLogger();
33+
const log = createLogger({ logLevel: envVars.PINO_LOG_LEVEL });
3434

3535
return {
3636
letterRepo: createLetterRepository(log, envVars),

lambdas/upsert-letter/src/config/env.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const EnvVarsSchema = z.object({
1616
const parsed = JSON.parse(str);
1717
return LetterVariantSchema.parse(parsed);
1818
}),
19+
PINO_LOG_LEVEL: z.coerce.string().optional(),
1920
});
2021

2122
export type EnvVars = z.infer<typeof EnvVarsSchema>;

0 commit comments

Comments
 (0)