mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-09 17:19:45 -04:00
9cf4af4ff2
# Description of Changes
This adds some logging utilities, that will probably be helpful for
debugging issues. `stdbLogger` can now accept lazy messages. If you call
`setGlobalLogLevel`, that will set a log level globally. It is set to
`info` by default, but when troubleshooting, we can ask people to run
`setGlobalLogLevel('trace')` and share more detailed logs.
In this PR, it adds a new new logs at the `trace` level:
- All outgoing messages to the server
- All incoming messages from the server
- After handling a server message, we log the number of triggered row
callbacks
There are also some formatting niceties to truncate large arrays and
redact fields that look like credentials.
We are also using `safe-stable-stringify` to handle some cases that
would be errors in `JSON.stringify`.
# API and ABI breaking changes
This adds the `setGlobalLogLevel` function, which is useful for
debugging.
# Expected complexity level and risk
1.5 - the only real risk here is that
# Testing
This has some tests of formatting in `logger.test.ts`.