Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4813

Implement the severity logging methods

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.4.0
    • Affects Version/s: 5.0.0
    • Component/s: None
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Description

      The logging spec introduced nine different severity levels and each severity level should have its own logging method.

      Acceptance Criteria

      Each severity logger should:

      • be marked as experimental
      • only get called when the severity is less than or equal to itself for the corresponding component
      • make use of a private helper to be called with the other eight logging methods in the future

      The private logging helper should:

      • generate a spec-compliant log that omits top-level null/nullish values and contains the timestamp, component, and severity keys at the top-level
      • convert BSON documents to EJSON
      • redact sensitive commands if needed
      • write objects to object streams (based on writableObjectMode flag on destination stream)
      • stringify the log before writing to the stream

      Other:

      • Update stream validation to check for a minimal interface instead of `instanceof Writable` and add a unit test to ensure compatible stream interfaces are accepted
      • Replace UnifiedLogCollector class (introduced in NODE-4685) in Unified Test runner with an object that implements the new minimal interface.
      • Update the Unified Spec Test Runner to be able to take logs in the format described in the Design Document and convert them to the format expected as laid out in the Unified Test Format Spec

      Implementation Notes

      Starting with implementing just one of these severity logging methods, in this case emergency, should ease the workload on reviewers. This allows us to get the core logic down quickly and once it gets approved the other severity logging methods will roughly follow the same format. 

      Internal data structures that are JS object should not be stringified nor truncated. BSON document stringification should be done via Node's utils.inspect().

      Testing

      In addition to testing the acceptance criteria listed above, test that the emergency logger:

      • can write a log to an existing stream
      • can write a log to a new stream
      • won't log events of disabled components

        There are no Sub-Tasks for this issue.

            Assignee:
            warren.james@mongodb.com Warren James
            Reporter:
            andy.mina@mongodb.com Andy Mina
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: