-
Type:
Bug
-
Resolution: Fixed
-
Affects Version/s: None
-
Component/s: Editor general
-
High
-
None
-
Improve frontend diagnostics by centralizing custom and system log submission in a reusable JavaScript component.
-
None
-
Emptyshow more show less
problem
The new console capture functionality in public/modules/editor/js/app/util/ConsoleCapture.js is useful for diagnosing frontend problems, but the current server logging integration is implemented directly in public/modules/editor/js/app/controller/Segments.js.
The segment save controller currently owns two logging helper methods, logFaultySegmentSave and logBackendModifiedFields, which build endpoint-specific payloads and call log/log or log/customlog directly. This makes the logging transport hard to reuse from other frontend code and keeps generic logging concerns coupled to segment save handling.
solution
Introduce a reusable frontend logging component, for example under public/modules/editor/js/app/util/, that encapsulates the existing log endpoints and exposes two methods:
- customLog(channel, message, data) posts to log/customlog
- systemLog(code, message, severity, data) posts to log/log
The component should keep the endpoint URLs, HTTP method and common request handling in one place while leaving domain-specific payload data, such as segment ids, mismatch details or ConsoleCapture snapshots, at the call site.
Refactor the segment save diagnostics in public/modules/editor/js/app/controller/Segments.js to use the new component instead of direct Ext.Ajax.request calls. Decide explicitly whether these helper methods should always return/behave asynchronously or whether callers control awaiting/fire-and-forget behaviour; document that decision in the component API.
Add targeted frontend/unit coverage where available, or otherwise cover the refactoring with the existing most suitable targeted test approach.