While developing your custom Hypersync app, you may need to debug unexpected behavior. The Hypersync SDK includes a logging framework to help you monitor app execution and diagnose issues. You can also use the Network tab in your browser’s Developer Tools for additional insight.
The SDK provides a Logger class for logging information as your app runs. The Logger class has four logging methods that differ only in the severity that is attached to the log output:
Logger.debug(message, detail)Logger.info(message, detail)Logger.warn(message, detail)Logger.error(message, detail)
All of these methods are asynchronous and return a Promise. In most cases, you should use the await keyword when calling them, e.g.:
await Logger.info('Creating my data source.');The SDK itself also uses the Logger class internally. Even if you have little to no logging in your code, the Logger statements in the SDK still provide some diagnostic information.
To view the logs as your app is executing, you must first obtain your app's ID. You can get this with the following Hyperproof CLI command:
hp customapps listWhen you have your app's ID, use this CLI command to view a live stream of the logs:
hp customapps logs --id <MY_APP_ID>While the logs command is running, actions performed on your app in Hyperproof (e.g. creating a new Hypersync, synchronizing, etc.) produce logging output in your terminal window. Note that there may be a short delay between the execution of the Logger statement and the display of that value in the terminal.
To exit the logs command, press Escape or Ctrl-C.
All supported browsers have a Developer Tools feature that can be helpful when diagnosing problems with your app.
When you encounter an unexpectd problem using your app, open the Developer Tools and navigate to the Network tab. Repeat the operation and look for network calls that are flagged as errors (shown in red in Google Chrome, for example). You can inspect the response bodies of these requests to learn more about what failed.