Events can be thought of as a "generic logging interface" for Data API & DevOps operations.
Though the LoggingConfig, you can also enable logging to the console, but:
You're forced to use stdout/stderr as outputs
You can't programmatically interact with the log data
You can't filter the logs
BaseClientEvents are a more flexible way to interact with the logs, allowing you to basically plug in, or
even build, your own logging system around them.
And, of course, you're free to use both events and console logging in tandem, if you so choose.
Note that these emit real commands, not any abstracted commands, such as insertMany or updateMany,
which may be split into multiple of those commands under the hood.
Overview
An enumeration of the events that may be emitted by the DataAPIClient, or any of its children classes, when logging is enabled.
See LoggingConfig for more information on how to configure logging, and enable/disable specific events.
When to prefer events
Events can be thought of as a "generic logging interface" for Data API & DevOps operations.
Though the LoggingConfig, you can also enable logging to the console, but:
BaseClientEvents are a more flexible way to interact with the logs, allowing you to basically plug in, or even build, your own logging system around them.
And, of course, you're free to use both events and console logging in tandem, if you so choose.
Disclaimer
Note that these emit real commands, not any abstracted commands, such as
insertMany
orupdateMany
, which may be split into multiple of those commands under the hood.Event types
There are two major categories of events emitted by the DataAPIClient:
Db
,Collection
,Table
operationsAstraAdmin
,DbAdmin
operationsEvery event may be enabled/disabled individually, independent of one another.
View each command's documentation for more information on the specific events they emit.
Commands
commandStarted
commandSucceeded
errors
are returned).commandFailed
errors
are returned).commandWarnings
status.warnings
field is present).Admin commands
adminCommandStarted
adminCommandPolling
adminCommandSucceeded
adminCommandFailed
adminCommandWarnings
status.warnings
field is present).