File tree Expand file tree Collapse file tree
letter-updates-transformer/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 11import { DynamoDBClient } from "@aws-sdk/client-dynamodb" ;
22import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb" ;
3- import pino from "pino" ;
3+ import { Logger } from "pino" ;
44import { SupplierRepository } from "@internal/datastore" ;
5+ import { createLogger } from "@internal/helpers/src" ;
56import { EnvVars , envVars } from "./env" ;
67
78export 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
1819function 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
3031export function createDependenciesContainer ( ) : Deps {
31- const log = pino ( ) ;
32+ const log = createLogger ( { logLevel : envVars . PINO_LOG_LEVEL } ) ;
3233
3334 return {
3435 supplierRepo : createSupplierRepository (
Original file line number Diff line number Diff 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
1011export type EnvVars = z . infer < typeof EnvVarsSchema > ;
Original file line number Diff line number Diff line change 1- import pino from "pino" ;
1+ import { Logger } from "pino" ;
22import { SNSClient } from "@aws-sdk/client-sns" ;
3+ import { createLogger } from "@internal/helpers/src" ;
34import { EnvVars , envVars } from "./env" ;
45
56export 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
1516export function createDependenciesContainer ( ) : Deps {
16- const log = pino ( ) ;
17+ const log = createLogger ( { logLevel : envVars . PINO_LOG_LEVEL } ) ;
1718
1819 return {
1920 snsClient : createSNSClient ( ) ,
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { z } from "zod";
33const 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
89export type EnvVars = z . infer < typeof EnvVarsSchema > ;
Original file line number Diff line number Diff line change 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" ,
Original file line number Diff line number Diff line change 1- import pino from "pino" ;
1+ import { Logger } from "pino" ;
22import { SNSClient } from "@aws-sdk/client-sns" ;
3+ import { createLogger } from "@internal/helpers/src" ;
34import { EnvVars , envVars } from "./env" ;
45
56export 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
1516export function createDependenciesContainer ( ) : Deps {
16- const log = pino ( ) ;
17+ const log = createLogger ( { logLevel : envVars . PINO_LOG_LEVEL } ) ;
1718
1819 return {
1920 snsClient : createSNSClient ( ) ,
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { z } from "zod";
22
33const EnvVarsSchema = z . object ( {
44 EVENTPUB_SNS_TOPIC_ARN : z . string ( ) ,
5+ PINO_LOG_LEVEL : z . coerce . string ( ) . optional ( ) ,
56} ) ;
67
78export type EnvVars = z . infer < typeof EnvVarsSchema > ;
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ function createLetterRepository(
3030}
3131
3232export function createDependenciesContainer ( ) : Deps {
33- const log = createLogger ( ) ;
33+ const log = createLogger ( { logLevel : envVars . PINO_LOG_LEVEL } ) ;
3434
3535 return {
3636 letterRepo : createLetterRepository ( log , envVars ) ,
Original file line number Diff line number Diff 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
2122export type EnvVars = z . infer < typeof EnvVarsSchema > ;
You can’t perform that action at this time.
0 commit comments