Comment on page

Sending logs

SDKs send logs to Hypertune Edge in the background. This allows you to:
  • See how often different parts of your flag logic are called, e.g. to see how often different targeting rules are evaluated and passed in realtime
  • Log events and exposures for your A/B tests and machine learning loops
  • See any SDK errors from the Hypertune UI

Manually flush logs

You can manually trigger and wait for logs to be flushed with hypertune.flushLogs():
import { NextFetchEvent, NextRequest } from "next/server";
import hypertune from "./lib/hypertune";
export async function middleware(
req: NextRequest,
context: NextFetchEvent
): Promise<void> {
await hypertune.initFromServerIfNeeded();
const rootNode = hypertune.root({
context: {
user: { id: "test", name: "Test", email: "[email protected]" },
const exampleFlag = rootNode.exampleFlag().get(/* fallback */ false);
console.log("Edge Middleware flag:", exampleFlag);
This is particularly useful in serverless environments, e.g. Vercel deployments, where background SDK tasks like fetching updates aren't guaranteed to execute.