Deployments: loading...

Service Logs

hook.io provides a simple integrated interface for logging from any Hook service. This integrated logging service is can be helpful for Service debugging or monitoring.

Writing to Hook Logs

To write to a Hook's logging output, simply call console.log('hello logging'); from inside the Hook.

Calling console.log in the Hook will automatically make the console log statement available as a logging entry.

Logs API

Accessing Hook Logs

To access the logs for a Hook simply attach /logs to the end of the Hook service url.

For example: https://hook.io/marak/echo/logs

The logging endpoint for a Hook will intelligently respond based on the incoming HTTP Accept Header.

Authentication

For Private Hooks, service logs are private. In order to access them from a third-party service, you'll need to generate a valid API Access Key with the logs::read role.

Below is a link which contains a limited role API Access Key created only for demonstration purposes.

http://hook.io/marak/echo/logs?hook_private_key=b4b1153f-ae6c-49f5-9cd7-1f554a6c1a1e

Streaming logs

To access streaming logs, request the logging endpoint with an Accept Header value of */*

Example: curl -N https://hook.io/marak/echo/logs

Plain Text Logs

To access plain text logs, request the logging endpoint with an Accept Header value of text/plain

Example: curl -H "Accept: text/plain" https://hook.io/marak/echo/logs

Client SDK

Using the Client SDK to access events is simple

Here are two examples of using the Client SDK. See SDK for more information

var sdk = require("hook.io-sdk");
var client = sdk.createClient({});
// callback style
client.logs.get('marak/echo', function (err, logs) {
  console.log(err, logs);
});
// streaming
client.events.stream('marak/echo', process.stdout);