Skip to content

Commit 542a5cc

Browse files
Fix: [AEA-5977] - Fix log level for Splunk report dependency (#2465)
## Summary - Routine Change ### Details Adjust dependent log line for PSU with Pharmacy log reporting. --------- Signed-off-by: Connor Avery <[email protected]>
1 parent 5c5924a commit 542a5cc

File tree

6 files changed

+20
-7
lines changed

6 files changed

+20
-7
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
// Log messages which are used for reporting purposes.
2+
// Before editing, consider reviewing in-use splunk reports.
13
export {testPrescriptionsConfig, TestPrescriptionsConfig, getTestPrescriptions} from "./testConfig.js"
24
export const LOG_MESSAGES = {
35
PSU0001: "Transitioning item status.",
46
PSU0002: "Notify request",
5-
PSU0003: "Updated notification state"
7+
PSU0003: "Updated notification state",
8+
PSU0004: "Building data item for task."
69
} as const
710

811
export {initiatedSSMProvider} from "./ssmUtil.js"

packages/updatePrescriptionStatus/src/updatePrescriptionStatus.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
testPrescription1Intercept,
3333
testPrescription2Intercept
3434
} from "./utils/testPrescriptionIntercept"
35-
import {getTestPrescriptions, initiatedSSMProvider} from "@psu-common/utilities"
35+
import {getTestPrescriptions, initiatedSSMProvider, LOG_MESSAGES} from "@psu-common/utilities"
3636

3737
export const LAMBDA_TIMEOUT_MS = 9500
3838
// this is length of time from now when records in dynamodb will automatically be expired
@@ -364,7 +364,8 @@ export function buildDataItems(
364364

365365
for (const requestEntry of requestEntries) {
366366
const task = requestEntry.resource as Task
367-
logger.debug("Building data item for task.", {task: task, id: task.id})
367+
// The following log line is utilised for PSU "with Pharmacy" reporting, required at info level for Prod running
368+
logger.info(LOG_MESSAGES.PSU0004, {task: task, id: task.id})
368369

369370
const repeatNo = task.input?.[0]?.valueInteger
370371

packages/updatePrescriptionStatus/tests/testHandler.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
timeoutResponse
3737
} from "../src/utils/responses"
3838
import {QueryCommand, TransactionCanceledException, TransactWriteItemsCommand} from "@aws-sdk/client-dynamodb"
39+
import {LOG_MESSAGES} from "@psu-common/utilities"
3940

4041
const {mockSend: dynamoDBMockSend} = mockDynamoDBClient()
4142

@@ -55,7 +56,8 @@ const mockInitiatedSSMProvider = {
5556

5657
jest.unstable_mockModule("@psu-common/utilities", async () => ({
5758
getTestPrescriptions: getTestPrescriptions,
58-
initiatedSSMProvider: mockInitiatedSSMProvider
59+
initiatedSSMProvider: mockInitiatedSSMProvider,
60+
LOG_MESSAGES: LOG_MESSAGES
5961
}))
6062

6163
const {handler, logger} = await import("../src/updatePrescriptionStatus")

packages/updatePrescriptionStatus/tests/testPrescriptionIntercept.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
getTestPrescriptions
1919
} from "./utils/testUtils"
2020
import {GetItemCommand, TransactionCanceledException, TransactWriteItemsCommand} from "@aws-sdk/client-dynamodb"
21+
import {LOG_MESSAGES} from "@psu-common/utilities"
2122

2223
export const mockGetParametersByName = jest.fn(async () => {
2324
return {}
@@ -29,7 +30,8 @@ const mockInitiatedSSMProvider = {
2930

3031
jest.unstable_mockModule("@psu-common/utilities", async () => ({
3132
initiatedSSMProvider: mockInitiatedSSMProvider,
32-
getTestPrescriptions: getTestPrescriptions // Use the mocked version defined in testUtils.ts
33+
getTestPrescriptions: getTestPrescriptions, // Use the mocked version defined in testUtils.ts
34+
LOG_MESSAGES: LOG_MESSAGES
3335
}))
3436

3537
const {mockSend} = mockDynamoDBClient()

packages/updatePrescriptionStatus/tests/testUpdatePrescriptionStatus.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import {APIGatewayProxyEvent} from "aws-lambda"
2020

2121
import * as content from "../src/validation/content"
2222
import {TransactionCanceledException} from "@aws-sdk/client-dynamodb"
23+
import {LOG_MESSAGES} from "@psu-common/utilities"
24+
2325
const mockValidateEntry = mockInternalDependency("../../src/validation/content", content, "validateEntry")
2426

2527
const mockGetParametersByName = jest.fn(async () => Promise.resolve(
@@ -32,7 +34,8 @@ const mockInitiatedSSMProvider = {
3234

3335
jest.unstable_mockModule("@psu-common/utilities", async () => ({
3436
getTestPrescriptions: getTestPrescriptions,
35-
initiatedSSMProvider: mockInitiatedSSMProvider
37+
initiatedSSMProvider: mockInitiatedSSMProvider,
38+
LOG_MESSAGES: LOG_MESSAGES
3639
}))
3740

3841
const {castEventBody, getXRequestID, validateEntries, handleTransactionCancelledException, buildDataItems, TTL_DELTA} =

packages/updatePrescriptionStatus/tests/validation/testRequestValidationViaHandler.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {ONE_DAY_IN_MS} from "../../src/validation/content"
2121
import requestSingleItem from "../../../specification/examples/request-dispatched.json"
2222
import requestMultipleItems from "../../../specification/examples/request-multiple-items.json"
2323
import {accepted, badRequest, bundleWrap} from "../../src/utils/responses"
24+
import {LOG_MESSAGES} from "@psu-common/utilities"
2425

2526
const mockGetParametersByName = jest.fn(async () => Promise.resolve(
2627
{[process.env.ENABLE_NOTIFICATIONS_PARAM!]: "false"}
@@ -32,7 +33,8 @@ const mockInitiatedSSMProvider = {
3233

3334
jest.unstable_mockModule("@psu-common/utilities", async () => ({
3435
getTestPrescriptions: getTestPrescriptions,
35-
initiatedSSMProvider: mockInitiatedSSMProvider
36+
initiatedSSMProvider: mockInitiatedSSMProvider,
37+
LOG_MESSAGES: LOG_MESSAGES
3638
}))
3739

3840
const {handler} = await import("../../src/updatePrescriptionStatus")

0 commit comments

Comments
 (0)