-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Logging
-
8
-
3
-
Not Needed
-
Not Needed
-
Description
Add error handling to the logger, so that logging does not crash users applications unneccessarily.
- Errors coming from driver - want to ensure our processing never fails
- Errors coming from stream / user - want to ensure if they give us a stream that cannot be worked with, do not want to crash
Acceptance Criteria
Implementation Requirements
Client Options Error Handling
- only crash when options of incorrect type (MongoClient.parseOptions will already handle this)
- mongodbLogPath
- If user stream crashes after construction
- output a 'client' component log "mongodbLogPath stream is crashed, Logging is halted."
- stop logging
- if stderr has an error,
- stop logging
- If user stream crashes after construction
Driver Side Error Handling
- Logger Class Methods
- try/catch stringifyWithMaxLen
- try/catch logDestination.write call
- .then(onRejected) for async write
- log
- ensure if non-LoggableEvent input is provided, logger does not throw
- logs stringified input along with component and time
- Ensure all properties needed for LoggableEvent (CommandStartedEvent, ConnectionPoolClosedEvent, etc..) construction are defined on class at time of construction + are of correct types
- Review all constructors of LoggableEvents and ensure none of them throw an exception explicitly
Testing Requirements
- Add unit tests for each case outlined here
There are no Sub-Tasks for this issue.