Type alias LoggingEvent

LoggingEvent: "all" | keyof DataAPIClientEventMap | RegExp
Overview

Represents the different events that can be emitted/logged by the DataAPIClient, or any of its children classes.

Additionally, you may use regular expressions or 'all' to match multiple events at once.

See DataAPIClientEventMap & LoggingConfig for much more info.

Regex matching

Regular expressions are a way to match multiple events at once. For example:

const client = new DataAPIClient({
logging: [{ events: `/.*(Started|Succeeded)/`, emits: 'stderr:verbose' }],
});

is equivalent to:

const client = new DataAPIClient({
logging: [{
events:
[ 'commandStarted', 'commandSucceeded'
, 'adminCommandStarted', 'adminCommandSucceeded'
],
emits: 'stderr:verbose',
}],
});
Using 'all'

'all' is simply a more semantic alternative to using the regex /.*/ to match all events. There is no functional difference between the two.

You may use it to enable all events at once with sane defaults:

logging: 'all'

Or to specify the output for all events at once:

logging: [{ events: 'all', emits: 'stderr:verbose' }]

Or even as a base config to override with specific rules later:

logging: ['all', { events: ['commandStarted', 'commandSucceeded'], emits: [] }]

See

  • LoggingConfig
  • LoggingOutput