Logging

Blockflow provides a robust logging system to help you track and monitor your instances. This documentation covers the two types of logs available in Blockflow: system logs and user logs.


System Logs

System logs are automatically generated by Blockflow and provide information about instance execution.

Key Information:

  • Timestamp of instance triggering

  • Block number at which the instance was triggered

  • Runtime of handlers


User Logs

User logs allow developers to add custom logging statements to their code for monitoring specific events or data.

To implement user logs in your Blockflow instance, you need to use the @blockflow-labs/logger library provided by Blockflow.

Log Levels

The logger library offers four log levels:

  1. debug: For detailed debugging information

  2. info: For general information

  3. warn: For warning messages

  4. error: For error messages

Implementation

To use the logger library in your code:

npm install @blockflow-labs/logger

Import it to your handler. And start logging.

import {Logger} from "@blockflow-labs/logger";

const logger = new Logger();

// Log messages
logger.info("Application started");
logger.warn("Low memory warning");
logger.error("Failed to connect to database");
logger.debug("Debugging information");


Viewing Logs

Both system logs and user logs can be viewed in the instance details under the "Logs" section of the Blockflow interface.

Last updated