Skip to content

Commit 6fb081c

Browse files
committed
Use same logging format
1 parent 289cbfd commit 6fb081c

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

lambdas/update-letter-queue/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"@aws-sdk/client-dynamodb": "^3.984.0",
44
"@aws-sdk/lib-dynamodb": "^3.984.0",
55
"@aws-sdk/util-dynamodb": "^3.943.0",
6-
"@internal/datastore": "*",
6+
"@internal/datastore": "^0.1.0",
7+
"@internal/helpers": "^0.1.0",
78
"aws-embedded-metrics": "^4.2.1",
89
"aws-lambda": "^1.0.6",
910
"esbuild": "0.27.2",

lambdas/update-letter-queue/src/deps.ts

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

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

@@ -16,7 +17,7 @@ function createDynamoDBDocumentClient(): DynamoDBDocumentClient {
1617
}
1718

1819
export function createDependenciesContainer(): Deps {
19-
const log = pino();
20+
const log = createLogger({ logLevel: envVars.PINO_LOG_LEVEL });
2021
const ddbClient = createDynamoDBDocumentClient();
2122

2223
const letterQueueRepository = new LetterQueueRepository(ddbClient, log, {

lambdas/update-letter-queue/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
LETTER_QUEUE_TABLE_NAME: z.string(),
55
LETTER_QUEUE_TTL_HOURS: z.coerce.number().int(),
6+
PINO_LOG_LEVEL: z.coerce.string().optional(),
67
});
78

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

package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)