✦ For Cloudflare Workers · Tail Workers · Hono · KV · D1 · Queues ✦
Cloudflare only keeps logs for 7 days. Error 1101 gives you none. CPU timeouts vanish. FlareLog uses a Tail Worker + SDK to capture it all — even when your code never fires.
Start with the Tail Worker for zero-code crash capture. Add the SDK for structured logs. Use Hono if that's your framework.
# 1. Clone the FlareLog Tail Worker template
git clone https://github.com/flarelog-dev/tail-worker.git
cd tail-worker
npm install
# 2. Add your FlareLog API key
wrangler secret put FLARELOG_API_KEY
# 3. Point your producer Workers at this Tail Worker
# In each Worker's wrangler.toml:
[[tail_consumers]]
service = "your-worker-name"
# 4. Deploy
npm run deployCaptures HTTP 500s, CPU timeouts, and uncaught errors even when your SDK never loads.
import { flarelog, workerFetch } from "@flarelog/sdk";
const logger = flarelog({ apiKey: env.FLARELOG_API_KEY });
export default {
fetch: (request, env, ctx) => {
return workerFetch(logger, async (request, env, ctx) => {
logger.info("Request received", {
url: request.url,
method: request.method,
});
try {
const result = await handleRequest(request, env);
logger.info("Request completed", { status: 200 });
return result;
} catch (err) {
logger.logError(err, { message: "Request failed" });
return new Response("Internal Error", { status: 500 });
}
})(request, env, ctx);
},
};Works with any Worker. No framework required.
import { Hono } from "hono";
import { flarelog } from "@flarelog/sdk";
import { honoMiddleware } from "@flarelog/sdk/hono";
const logger = flarelog({ apiKey: env.FLARELOG_API_KEY });
const app = new Hono();
// One-line middleware for all routes
app.use("*", honoMiddleware(logger));
app.get("/api/users/:id", async (c) => {
const log = c.get("logger");
log.info("Fetching user", { userId: c.req.param("id") });
try {
const user = await c.env.DB
.prepare("SELECT * FROM users WHERE id = ?")
.bind(c.req.param("id"))
.first();
if (!user) {
log.warn("User not found");
return c.json({ error: "Not found" }, 404);
}
return c.json(user);
} catch (err) {
log.logError(err, { message: "Failed to fetch user" });
return c.json({ error: "Internal error" }, 500);
}
});
export default app;Most popular Workers framework. One-line middleware.
# Add your FlareLog project API key
wrangler secret put FLARELOG_API_KEY
# Optional: set environment and release
FLARELOG_ENVIRONMENT=production
FLARELOG_RELEASE=1.0.0ctx.waitUntil() so they reach your dashboard.Add one Tail Worker to capture HTTP 500s, CPU timeouts, OOM, and uncaught errors across your whole account — even when the producer's SDK never loads.
KV writes, R2 operations, and CPU duration are estimated per request. Get alerted on Slack or email when spend crosses your threshold.
Filter by route, error type, status code, or any JSON metadata. Retain logs for 90 days on Pro instead of Cloudflare's 7-day limit.
Inject trace context into service bindings and outbound fetch calls. Trace requests across multiple Workers, clouds, and backends.
The SDK is zero-dependency and Workers-native. workerFetch() and honoMiddleware handle flushing via ctx.waitUntil() automatically.
Ask Cursor or Claude "why did my Worker 500 in fra?" The MCP server returns live logs with full context and suggests fixes.
90d
retention on Pro
10k
free logs/mo
$19
flat Pro bucket
0
runtime dependencies
Not for crash capture. The Tail Worker attaches externally and sees failures even when your own SDK never loads. For structured logging, add the SDK — it's one middleware line.
No. The Tail Worker runs out-of-band and has zero impact on request latency. The SDK flushes asynchronously via ctx.waitUntil(), adding sub-millisecond overhead per invocation.
Yes. Tail Workers are available on all plans. FlareLog's free tier includes 10,000 logs/mo and 7-day retention.
The SDK has dedicated support for Hono and works with any fetch-based framework via workerFetch(). Durable Objects, Queues, Cron, and R2 are all covered in the docs.
FlareLog reads CPU time, subrequests, KV operations, and other metadata from Tail Worker events. It estimates per-request cost and alerts you via Slack or email when a threshold is crossed.
The Tail Worker only forwards telemetry — logs, errors, and resource metadata — to FlareLog. It doesn't proxy user traffic or read request bodies unless you explicitly log them.
Free tier includes 10,000 logs/month and Tail Worker crash capture. No credit card. No changes to your core Workers.