-
Notifications
You must be signed in to change notification settings - Fork 22
Conversation
Hi, Would a better approach be to define the logger in the fhirConfig interface as you've done, but put the implementation into a different component e.g. the FWoA deployment, or a new FWoA logger component? |
Co-authored-by: Robert Smayda <smayda44@gmail.com>
Hi Allan, Thanks for your interest in FWoA! It's a great point not having implementation in the interface package. We talked about Meanwhile, I'm curious what approach did you take in creating a logging mechanism? Thanks, |
Hi Yanyu, We have a slightly different approach here at Black Pear; we're using the FWoA interface and router, but for the search & persistence components we've built an architecture that allows us to plug in different modules dependent on what services the customer needs. So we could provide a general FHIR server by plugging in the existing FWoA Dynamo & ES persistence components. Or we can plug in one of our own search & persistence components, for example to interface with a 3rd party clinical system that doesn't use FHIR and provide a FHIR facade for it. We've added several components including logging, audit & cache into FWoA by wrapping the components in a wrapper a bit like this:
then we build a our deployment with something along the lines of:
Our logging mechanism is pretty simple, at the moment we are just logging to cloudwatch with the standard levels. But with our approach we could switch in Winston, or could add a custom component e.g SNS publish, as required. |
Hi @AllanHodkinson, Thanks for explaining your approach in detail! It does make sense to wrap functionalities like log, cache and audit into a helper component and shared it in its entirety in the architecture you described. A follow up question on the helper component, is it a standalone repo or is it part of another existing repo in your architecture? Also, as part of this change, I was planning to remove the log levels export from the interface package, and remove the log level setting from the deployment package. I'm wondering if removing the settings or any of the changes in this PR would be a breaking change for you? I want to make sure we don't make a negative impact here. Thanks, |
Hi Yanyu, Thanks for the heads up on the logging levels change, we're not currently using this. We have an env var that allows us to set this directly. |
14de9bc
to
3baa9fd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before we merge this in can we tag and release the existing changes so that they are not bundled with this breaking change?
Existing changes are tagged and released. Dismiss this review as Robert is on vacay so let's leave him alone :)
Issue #, if available:
Description of changes:
Add log builder in interface package
Deployed and tested in an AWS account
Example log output
Unhandled error:
One string:
this.logger.info('tada-info');
One string and one object:
this.logger.error('tada-error', {name: 'tada-error', desc: 'this is a error in JSON with multiple item' });
Two string and two objects:
Log error and stack:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.