Logger utility

Search JS SDK for React offers a logging utility that you can use during development. You can monitor data requests and responses, and also watch values while debugging in development.

Typical scenarios also include using the utility to confirm your components are making the desired requests or dispatching the desired payloads when tracking visitor interactions.

Screenshot of a search request and response log in the browser console.
Screenshot of an event tracking log in the browserr console.

Logger level values

The logging utility in the JS SDK is flexible and you can customize its use. You can choose what you would like to log and appear in your browser console. The following are acceptable Logger level values:

  • Logger.NONE - prints nothing.

  • Logger.ERROR - prints errors only.

  • Logger.WARN - prints errors and warnings.

  • Logger.INFO - prints errors, warnings, and information.

  • Logger.DEBUG - prints errors, warnings, and information. Also available for debugging.

  • Logger.TRACE - prints everything and is available for debugging.

Important

To prevent tracing in production, set the Logger level to Logger.NONE.

Do you have some feedback for us?

If you have suggestions for improving this article,