---
title: "Hono"
description: "Use Blyp as Hono middleware and read the request logger from context variables."
canonical_url: "https://www.blyp.dev/docs/integrations/hono"
markdown_url: "https://www.blyp.dev/docs/integrations/hono.md"
last_updated: "2018-10-20"
x_farming_labs_generated_preamble: true
---

# Hono
URL: /docs/integrations/hono
LLM index: /llms.txt
Description: Use Blyp as Hono middleware and read the request logger from context variables.

# Hono

Import from `@blyp/core/hono`.

```ts
import { Hono } from "hono";
import { createLogger } from "@blyp/core/hono";

const app = new Hono();

app.use("*", createLogger({
  level: "info",
  customProps: () => ({ framework: "hono" }),
}));

app.get("/hello", (context) => {
  context.get("blypLog").info("hono-route");
  return context.text("ok");
});
```

## Notes

- the request logger is stored in `context.get("blypLog")`
- the middleware handles both success and thrown error flows
- `POST /inngest` is intercepted automatically when client logging is enabled

## What auto-logged requests look like

With automatic request logging enabled, Blyp emits terminal output like:

```text
[INFO]  GET  /health        200  2ms
[INFO]  POST /checkout      200  143ms
[INFO]  GET  /users/42      404  8ms
[ERROR] POST /payments      500  1203ms
```

Fields included automatically: method, path, status code, and duration.

**In production (NDJSON):**

```json
{"level":"info","time":1710000000000,"msg":"GET /health","type":"http_request","method":"GET","url":"/health","statusCode":200,"responseTime":2}
{"level":"info","time":1710000000001,"msg":"POST /checkout","type":"http_request","method":"POST","url":"/checkout","statusCode":200,"responseTime":143}
```

## Relevant types

```ts
import type {
  HonoLoggerConfig,
  HonoLoggerVariables,
} from "@blyp/core/hono";
```

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
Docs-scoped sitemap: [/docs/sitemap.md](/docs/sitemap.md).
Well-known sitemap: [/.well-known/sitemap.md](/.well-known/sitemap.md).
