Skip to content

Update to allow for toggling on/off logging each API request to stdout or to a log file - #53

Merged
Jakub Wlodek (jwlodek) merged 4 commits into
NSLS2:mainfrom
jwlodek:add-request-logging-feature
Sep 30, 2026
Merged

Jakub Wlodek (jwlodek) merged 4 commits into
NSLS2:mainfrom
jwlodek:add-request-logging-feature

Conversation

@jwlodek

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI balanced review requested due to automatic review settings September 30, 2026 14:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

The timestamp implementation uses localtime_r, which breaks the supported Windows build.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Adds configurable per-request HTTP logging to stdout or a selected file.

Changes:

  • Adds thread-safe request logging to the XSPD API.
  • Exposes logging controls through EPICS records and the operator interface.
  • Adds unit tests for logging behavior and errors.
File Description
xspdApp/​tests/​TestXSPDAPI.cpp Tests request logging behavior.
xspdApp/​src/​XSPDAPI.h Declares logging API and state.
xspdApp/​src/​XSPDAPI.cpp Implements request logging.
xspdApp/​src/​ADXSPDParamDefs.h Defines the logging parameter.
xspdApp/​src/​ADXSPDParamDefs.cpp Creates the logging parameter.
xspdApp/​src/​ADXSPD.h Declares driver logging handlers.
xspdApp/​src/​ADXSPD.cpp Integrates logging with driver parameters.
xspdApp/​op/​bob/​ADXSPD.bob Adds operator logging controls.
xspdApp/​Db/​ADXSPD.template Adds logging and file records.
xspdApp/​Db/​ADXSPD_settings.req Persists file settings.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread xspdApp/src/XSPDAPI.cpp
Copilot AI balanced review requested due to automatic review settings September 30, 2026 16:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

Review effort: Balanced
Findings: None

Resolved since last review (1)

Copilot AI balanced review requested due to automatic review settings September 30, 2026 16:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Logging exposes an unsafe public method and can report an enabled state after file activation fails.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Previously missed (1)

In code that hasn't changed since last review

Medium severity Enable failure leaves logging parameter enabled after logging is disabled

xspdApp/​src/​ADXSPD.cpp:834

If enabling fails while this parameter already reads 1 (for example, its directory was removed and the client writes 1 again), EnableRequestLogging has already disabled logging, but the exception returns before the parameter is updated. The readback then remains Enabled even though no requests are logged. Reset the parameter to 0 and publish callbacks before propagating the failure, as the writeOctet failure path does.

Comment thread xspdApp/src/XSPDAPI.h
@jwlodek
Jakub Wlodek (jwlodek) merged commit 4f12090 into NSLS2:main Sep 30, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants