log utility is a function that's used for logging debugging, warning, and error information about the application. Use this utility by importing
@shopify/hydrogen, or by using a
log prop passed to each page component. We recommend using the
log prop passed to each page because it will associate your log to the current request in progress.
Example codeAnchor link to section titled "Example code"
log utility exposes the following methods for logging information at different priorities:
||The lowest priority logs. These logs are very verbose.|
||The normal priority logs. Used internally for logging route timing information.|
||The high priority warnings that might or might not cause the application to fail.|
||The logging used for errors or invalid application state.|
||The logging used just prior to the process exiting.|
Swap logger implementation and optionsAnchor link to section titled "Swap logger implementation and options"
Hydrogen includes a default logger implementation that can be swapped for a logger of your choice. You can also show debugging information for cache and queries by providing extra options. For more information, refer to Hydrogen configuration.