util/logging.ts: Add LogHandler interface, LogLevel enum, and ConsoleLogHandler.
Description
Add a log handler interface and implementation.
Motivation and context
Following a LSE where we couldn't get reliable information from the customer side, we decided to add a logging facility to all of the drivers.
I spent a few hours surveying log library options in JavaScript/TypeScript. The conclusion that I came to is that they are either bulkier than what we need (log4js-node) or so simple that it's not worth us taking a dependency (pino), hence the strategy I adopted in this PR.
TODO: This PR does not yet actually call our log function from the request/response path, I thought the tests were failing on Monday. They appear to pass in GitHub Actions, so maybe that's a "fails on my machine" type of thing.
How was the change tested?
Unit tests?
Screenshots (if appropriate):
Change types
[ ] Bug fix (non-breaking change that fixes an issue)
[x] New feature (non-breaking change that adds functionality)
[ ] Breaking change (backwards-incompatible fix or feature)
Checklist:
[x] My code follows the code style of this project.
[ ] My change requires a change to Fauna documentation.
[ ] My change requires a change to the README, and I have updated it accordingly.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
util/logging.ts: Add LogHandler interface, LogLevel enum, and ConsoleLogHandler.
Description
Add a log handler interface and implementation.
Motivation and context
Following a LSE where we couldn't get reliable information from the customer side, we decided to add a logging facility to all of the drivers.
I spent a few hours surveying log library options in JavaScript/TypeScript. The conclusion that I came to is that they are either bulkier than what we need (log4js-node) or so simple that it's not worth us taking a dependency (pino), hence the strategy I adopted in this PR.
TODO: This PR does not yet actually call our log function from the request/response path, I thought the tests were failing on Monday. They appear to pass in GitHub Actions, so maybe that's a "fails on my machine" type of thing.
How was the change tested?
Unit tests?
Screenshots (if appropriate):
Change types
Checklist:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.