feat(csms): 增强 OCPP 操作的日志记录,添加请求和响应的详细信息

This commit is contained in:
2026-04-20 14:28:27 +08:00
parent d688a8497d
commit 073bae726a
9 changed files with 207 additions and 18 deletions

View File

@@ -12,6 +12,10 @@ export async function handleBootNotification(
payload: BootNotificationRequest,
ctx: OcppConnectionContext,
): Promise<BootNotificationResponse> {
console.info(
`[OCPP][ACTION][BootNotification][BEGIN] cp=${ctx.chargePointIdentifier} vendor=${payload.chargePointVendor} model=${payload.chargePointModel} fw=${payload.firmwareVersion ?? 'n/a'}`,
)
const db = useDrizzle()
const { heartbeatInterval } = await getOcpp16jSettings()
@@ -57,7 +61,9 @@ export async function handleBootNotification(
const status = cp.registrationStatus
ctx.isRegistered = status === 'Accepted'
console.log(`[OCPP] BootNotification ${ctx.chargePointIdentifier} status=${status}`)
console.info(
`[OCPP][ACTION][BootNotification][END] cp=${ctx.chargePointIdentifier} status=${status} heartbeatInterval=${heartbeatInterval}`,
)
return {
currentTime: dayjs().toISOString(),