How-to
Integrate flags with Runtime Logs
Integrate your feature flag provider with runtime logs.Table of Contents
Next.js (/app)
On your dashboard, the Logs tab displays your runtime logs. It can also display any feature flags your application evaluated while handling requests.
To make the runtime logs aware of your feature flag call reportValue(name, value)
with the flag name and value to be reported. Each call to reportValue
will show up as a distinct entry, even when the same key is used:
app/api/test/route.ts
import { reportValue } from '@vercel/flags';
// force dynamic mode so the flag actually gets reported,
// otherwise the route would be static
export const dynamic = 'force-dynamic';
export async function GET() {
reportValue('summer-sale', false);
return Response.json({ ok: true });
}
If you are using an implementation of the Feature Flags
pattern you
don't need to call reportValue
. The respective implementation will
automatically call reportValue
for you.
The following limits apply to reported values:
- Keys are truncated to 256 characters
- Values are truncated to 256 characters
- Reported values must be JSON serializable or they will be ignored
Last updated on July 24, 2024
Was this helpful?