/Knowledge/sources/honojs__hono/llms-full/logger-middleware-options-example--3e523ee626ad.md
Logger Middleware: Options > Example - hono-docs
Logger Middleware: Options Example Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms full.txt example Summary Set...
Logger Middleware: Options > Example
Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#example
Summary
Setting up a custom PrintFunc function to the Logger Middleware: ts export const customLogger = (message: string, ...rest: string[]) => { console.log(message, ...rest) } app.use(logger(customLogger)) Setting up the custom logger...
Content
Setting up a custom PrintFunc function to the Logger Middleware:
export const customLogger = (message: string, ...rest: string[]) => {
console.log(message, ...rest)
}
app.use(logger(customLogger))
Setting up the custom logger in a route:
app.post('/blog', (c) => {
// Routing logic
customLogger('Blog saved:', `Path: ${blog.url},`, `ID: ${blog.id}`)
// Output
// <-- POST /blog
// Blog saved: Path: /blog/example, ID: 1
// --> POST /blog 201 93ms
// Return Context
})
Metadata
{
"chunk_index": 0,
"citation": "https://hono.dev/llms-full.txt#example",
"coverage_role": "overview",
"qualified_title": "Hono / llms-full / Logger Middleware > Options > Example",
"retrieved_at": "2026-07-02T05:51:01Z",
"section_index": 153,
"source_id": "/honojs/hono",
"source_type": "llms_full",
"target_label": "llms-full",
"title": "Logger Middleware: Options > Example",
"upstream_url": "https://hono.dev/llms-full.txt",
"version": "2026"
}