Add useful core events to server & logger #4419
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Short Description and Why It's Useful
I tried to implement application-side monitoring using DataDog, but I stumbled about fact that I cant find entrypoints to implement my code without changing the core.
These are some suggestions for events to implement to make the VSF more accessible for changes.
beforeLogRenderedmutator-hookI added a
beforeLogRenderedmutator-hook to be able to implement a custom logger (winstonin my case) or mutate the log messages. This way I can add the hook in a module and optionally "disable" the default logging output if needed – like in my case as I use a custom logging library with a custom format.I also changed some missing
Loggerclass implementations in the code where stillconsole.logwas used.ssrExceptionevent-hookThis is an event hook to be called when an exception is happening on server-side rendering.
My use-case for this was that I wanted to track exceptions using this event to create a healt-check for the running application process.
httpServerIsReadyevent-hookThis event is triggered just once when the
ExpressJSserver is ready and would be handy if you for example wan't to bind tohttp.serverevents.In my case I needed this (again) for my process health-check when I implemented
lightshipto give the signal that the server is ready.These are just suggestions and maybe are mostly not necessary to run the shop in general but are handy if you need to extend it. I think these entrypoints would be useful for other usecases as well and won't have any impact if not needed.
Which Environment This Relates To
Check your case. In case of any doubts please read about Release Cycle
developbranch and want to merge it back todevelopreleasebranch and want to merge it back toreleasehotfixormasterbranch and want to merge it back tohotfixUpgrade Notes and Changelog
IMPORTANT NOTICE - Remember to update
CHANGELOG.mdwith description of your changeContribution and Currently Important Rules Acceptance