πŸ“• Event Logs

Event Logs are like structured log entries, similar to tables in a traditional database. They are ideal for recording specific, individual occurrences with rich details. They are searchable and filterable in the Sentio UI.

Accessed via: ctx.eventLogger

Log Levels

Sentio allows users to submit and search for logs. Logs naturally have 5 levels:

  • DEBUG
  • INFO
  • WARNING
  • ERROR
  • CRITICAL

System Labels

Sentio also attaches system labels automatically to the log, including:

  • Contract
  • Address
  • Chain

Event Analytics

Follow event-analytics-dashboard to learn how to visualize Events.

Filter Event Logs on UI

Using the menu on the left hand side, users can filter the log based on #log-levels and #system-labels. The Labels selection is standard faceted search filters.

  • Click a label switch between All and Only
  • Click the checkbox exclude a label

Full Text Search

We support full-text search on logs. If you want to search all the SWAP USDC:

Search with conditions

Term

Let's find all the logs with a given distinct_id

Range

Let's find all the logs with value between 1 to 3.

Composite conditions

The conditions are composable

Submit Event Logs

Users can write the following code to submit logs in processor using the following code:

ctx.eventLogger.emit("Deposit",
  {
    distinctId: event.args.from, // optional, enable for analytic use case
    severity: LogLevel.INFO, // optional
    message: `Deposit ${amount} ${tokenInfo.symbol} at ${ctx.blockNumber}`, // optional, enable for better text search
    amount: amount, // you can also put other attributes
  }
)

The supported log levels are:

export enum LogLevel {
  DEBUG = 0,
  INFO = 1,
  WARNING = 2,
  ERROR = 3,
  CRITICAL = 4,
}

Distinct ID

You might notice there is a distinctId field. If missing, null is used. Note that this field is critical for Sentio to compute analytics related to DAU, WAU, etc.

If you'd like to emit a log for all swap user activities in order to compute the daily unique wallets, you could do the following:

 .onEventSwapEvent(async (evt, ctx) => {
   ctx.eventLogger.emit("user", { distinctId: ctx.transaction.sender })
 })