This page will walk you through editing a Binaris function and reading the execution logs after invocation.
If you are new to Binaris it is recommended that you begin with the previous tutorial:
Note: the instructions below assume you are using MacOS, Ubuntu or Debian.
1. Edit your function
bn create node8 hello command that you used in the previous getting-started tutorial creates a file called
The function receives two arguments.
body holds the HTTP request body, and
context holds HTTP request and response parameters (such as query strings and headers). Objects returned from a function are automatically JSON-ified and sent as the HTTP response body.
Modify the code
function.js file for the
After updating the code the function will need to be deployed again.
Next, invoke the function to test the changes:
2. Use Binaris logs
console based logging. This means anything written to
stdout (such as
console.log) will be accessible via the
bn logs command.
As an example, you can log the
name argument of your function with the change below.
Deploy and invoke the changed code.
bn logs to view the log entries.
bn logs supports logging Objects natively.
For more information about the Binaris logging capabilities use
bn logs --help.
You can use
bn --help to see all the available CLI commands.
- Next Tutorial: Call a function from another function