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.
Debug class
My implementation is generic, by design.
After instantiating a new Debug object with config, a simple JSON object
payload can be passed to the send() function. If that object's "type"
property is allowed by the current log level, then the output tagged
with metadata and the complete JSON object is passed as a string to
xdmp.log()
A payload type value that is not of an accepted type is rejected.
A payload type value that requires a higher log level than currently specified is rejected.
All rejected payloads return an Error object with message:
"Error: Log level "{this.logLevel}" does not have permission to log type: {payload type}"
If we want, we can add payload validation, ensuring that the payload type has the proper
parameters (ie. type "error" could require a "stack" property in the payload object)