@logtape/hono 2.2.0-dev.702 → 2.2.0-dev.708

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/mod.cjs CHANGED
@@ -297,6 +297,7 @@ function honoLogger(options = {}) {
297
297
  const honoContext = c;
298
298
  const handleRequest = async (requestContextState$1) => {
299
299
  const requestContext = requestContextState$1.context;
300
+ applyResponseHeaders(honoContext, requestContextState$1);
300
301
  if (logRequest) {
301
302
  if (!skip(honoContext)) {
302
303
  const result$1 = withRequestLogContext(formatFn(honoContext, 0), requestContext);
package/dist/mod.js CHANGED
@@ -296,6 +296,7 @@ function honoLogger(options = {}) {
296
296
  const honoContext = c;
297
297
  const handleRequest = async (requestContextState$1) => {
298
298
  const requestContext = requestContextState$1.context;
299
+ applyResponseHeaders(honoContext, requestContextState$1);
299
300
  if (logRequest) {
300
301
  if (!skip(honoContext)) {
301
302
  const result$1 = withRequestLogContext(formatFn(honoContext, 0), requestContext);
package/dist/mod.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.js","names":["options: boolean | RequestContextOptions | undefined","options: boolean | RequestIdOptions | undefined","value: string","c: HonoContext","options: RequestIdOptions","responseHeader","responseTime: number","resolvedRequestId: ResolvedRequestId | undefined","include: readonly RequestContextField[]","context: Record<string, unknown>","options: RequestContextOptions","requestContext: HonoRequestContextState","result: string | Record<string, unknown>","predefinedFormats: Record<PredefinedFormat, FormatFunction>","category: string | readonly string[]","options: HonoLogTapeOptions","formatFn: FormatFunction","requestContextState: HonoRequestContextState","requestContextState","result"],"sources":["../src/mod.ts"],"sourcesContent":["import { getLogger, type LogLevel, withContext } from \"@logtape/logtape\";\nimport { createMiddleware } from \"hono/factory\";\nimport type { Context, MiddlewareHandler } from \"hono\";\n\nexport type { LogLevel } from \"@logtape/logtape\";\n\n/**\n * Hono context interface exposed to custom formatters and skip callbacks.\n *\n * This matches the actual runtime object passed to the middleware, so custom\n * formatters can access context variables via methods like `c.get()` when\n * needed.\n * @since 1.3.0\n */\n// deno-lint-ignore no-explicit-any\nexport interface HonoContext extends Context<any, any, any> {}\n\n/**\n * Predefined log format names compatible with Morgan.\n * @since 1.3.0\n */\nexport type PredefinedFormat = \"combined\" | \"common\" | \"dev\" | \"short\" | \"tiny\";\n\n/**\n * Custom format function for request logging.\n *\n * @param c The Hono context object.\n * @param responseTime The response time in milliseconds.\n * @returns A string message or an object with structured properties.\n * @since 1.3.0\n */\nexport type FormatFunction = (\n c: HonoContext,\n responseTime: number,\n) => string | Record<string, unknown>;\n\n/**\n * Structured log properties for HTTP requests.\n * @since 1.3.0\n */\nexport interface RequestLogProperties {\n /** HTTP request method */\n method: string;\n /** Request URL */\n url: string;\n /** Request path */\n path: string;\n /** HTTP response status code */\n status: number;\n /** Response time in milliseconds */\n responseTime: number;\n /** Response content-length header value */\n contentLength: string | undefined;\n /** User-Agent header value */\n userAgent: string | undefined;\n /** Referrer header value */\n referrer: string | undefined;\n}\n\n/**\n * Request fields that can be added to the implicit request context.\n * @since 2.2.0\n */\nexport type RequestContextField =\n | \"requestId\"\n | \"method\"\n | \"url\"\n | \"path\"\n | \"userAgent\"\n | \"remoteAddr\"\n | \"referrer\";\n\n/**\n * Options for extracting, generating, and propagating a request ID.\n * @since 2.2.0\n */\nexport interface RequestIdOptions {\n /**\n * The property name used in implicit context and request log records.\n * @default \"requestId\"\n */\n readonly property?: string;\n\n /**\n * Incoming request headers to inspect in order.\n * @default [\"x-request-id\"]\n */\n readonly headerNames?: readonly string[];\n\n /**\n * Response header that receives the resolved request ID.\n * Set to `false` to disable response header propagation.\n * @default \"x-request-id\"\n */\n readonly responseHeader?: string | false;\n\n /**\n * Generates a request ID when no incoming header is present.\n * @default crypto.randomUUID()\n */\n readonly generate?: () => string;\n\n /**\n * Normalizes an incoming request ID. Return `null` to reject the value and\n * keep looking for another header or generate a new ID.\n */\n readonly normalize?: (value: string) => string | null;\n}\n\n/**\n * Options for request-scoped implicit context.\n * @since 2.2.0\n */\nexport interface RequestContextOptions {\n /**\n * Enables request ID extraction, generation, and response propagation.\n * @default true\n */\n readonly requestId?: boolean | RequestIdOptions;\n\n /**\n * Fields to add to the implicit context.\n * @default [\"requestId\"]\n */\n readonly include?: readonly RequestContextField[];\n\n /**\n * Adds application-specific fields to the implicit request context.\n */\n readonly enrich?: (\n c: HonoContext,\n ) => Record<string, unknown> | Promise<Record<string, unknown>>;\n}\n\n/**\n * Options for configuring the Hono LogTape middleware.\n * @since 1.3.0\n */\nexport interface HonoLogTapeOptions {\n /**\n * The LogTape category to use for logging.\n * @default [\"hono\"]\n */\n readonly category?: string | readonly string[];\n\n /**\n * The log level to use for request logging.\n * @default \"info\"\n */\n readonly level?: LogLevel;\n\n /**\n * The format for log output.\n * Can be a predefined format name or a custom format function.\n *\n * Predefined formats:\n * - `\"combined\"` - Apache Combined Log Format (structured, default)\n * - `\"common\"` - Apache Common Log Format (structured, no referrer/userAgent)\n * - `\"dev\"` - Concise colored output for development (string)\n * - `\"short\"` - Shorter than common (string)\n * - `\"tiny\"` - Minimal output (string)\n *\n * @default \"combined\"\n */\n readonly format?: PredefinedFormat | FormatFunction;\n\n /**\n * Function to determine whether logging should be skipped.\n * Return `true` to skip logging for a request.\n *\n * @example Skip logging for health check endpoint\n * ```typescript\n * app.use(honoLogger({\n * skip: (c) => c.req.path === \"/health\",\n * }));\n * ```\n *\n * @default () => false\n */\n readonly skip?: (c: HonoContext) => boolean;\n\n /**\n * If `true`, logs are written immediately when the request is received.\n * If `false` (default), logs are written after the response is sent.\n *\n * Note: When `logRequest` is `true`, response-related properties\n * (status, responseTime, contentLength) will not be available.\n *\n * @default false\n */\n readonly logRequest?: boolean;\n\n /**\n * Enables request-scoped implicit context and request ID correlation.\n *\n * When set to `true`, the middleware reads the `x-request-id` header,\n * generates one when it is absent, writes it to the `x-request-id` response\n * header, and adds `requestId` to all LogTape records emitted while handling\n * the request.\n *\n * @default false\n * @since 2.2.0\n */\n readonly context?: boolean | RequestContextOptions;\n}\n\nconst defaultRequestIdHeader = \"x-request-id\";\n\ninterface ResolvedRequestId {\n readonly property: string;\n readonly value: string;\n readonly responseHeader?: string;\n}\n\ninterface HonoRequestContextState {\n readonly context: Record<string, unknown>;\n readonly responseHeader?: {\n readonly name: string;\n readonly value: string;\n };\n}\n\n/**\n * Normalize request context options.\n */\nfunction normalizeRequestContextOptions(\n options: boolean | RequestContextOptions | undefined,\n): RequestContextOptions | undefined {\n if (options === true) return {};\n if (options === false || options == null) return undefined;\n return options;\n}\n\n/**\n * Normalize request ID options.\n */\nfunction normalizeRequestIdOptions(\n options: boolean | RequestIdOptions | undefined,\n): RequestIdOptions | undefined {\n if (options === false) return undefined;\n if (options === true || options == null) return {};\n return options;\n}\n\n/**\n * Generate a request ID with Web Crypto when possible.\n */\nfunction generateRequestId(): string {\n if (typeof globalThis.crypto?.randomUUID === \"function\") {\n return globalThis.crypto.randomUUID();\n }\n return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;\n}\n\n/**\n * Normalize an incoming request ID.\n */\nfunction defaultNormalizeRequestId(value: string): string | null {\n const trimmed = value.trim();\n return trimmed === \"\" ? null : trimmed;\n}\n\n/**\n * Resolve the request ID for a request.\n */\nfunction resolveRequestId(\n c: HonoContext,\n options: RequestIdOptions,\n): ResolvedRequestId {\n const property = options.property ?? \"requestId\";\n const normalize = options.normalize ?? defaultNormalizeRequestId;\n const headerNames = options.headerNames ?? [defaultRequestIdHeader];\n for (const headerName of headerNames) {\n const headerValue = c.req.header(headerName);\n if (headerValue == null) continue;\n const normalized = normalize(headerValue);\n if (normalized != null) {\n const responseHeader = options.responseHeader ?? defaultRequestIdHeader;\n return {\n property,\n value: normalized,\n responseHeader: responseHeader === false ? undefined : responseHeader,\n };\n }\n }\n const generated = (options.generate ?? generateRequestId)();\n const responseHeader = options.responseHeader ?? defaultRequestIdHeader;\n return {\n property,\n value: generated,\n responseHeader: responseHeader === false ? undefined : responseHeader,\n };\n}\n\n/**\n * Get referrer from request headers.\n */\nfunction getReferrer(c: HonoContext): string | undefined {\n return c.req.header(\"referrer\") || c.req.header(\"referer\");\n}\n\n/**\n * Get user agent from request headers.\n */\nfunction getUserAgent(c: HonoContext): string | undefined {\n return c.req.header(\"user-agent\");\n}\n\n/**\n * Get remote address from X-Forwarded-For header.\n */\nfunction getRemoteAddr(c: HonoContext): string | undefined {\n const forwarded = c.req.header(\"x-forwarded-for\");\n if (forwarded == null) return undefined;\n const firstIp = forwarded.split(\",\")[0].trim();\n return firstIp || undefined;\n}\n\n/**\n * Get content length from response headers.\n */\nfunction getContentLength(c: HonoContext): string | undefined {\n const contentLength = c.res.headers.get(\"content-length\");\n if (contentLength === null) return undefined;\n return contentLength;\n}\n\n/**\n * Build structured log properties from context.\n */\nfunction buildProperties(\n c: HonoContext,\n responseTime: number,\n): RequestLogProperties {\n return {\n method: c.req.method,\n url: c.req.url,\n path: c.req.path,\n status: c.res.status,\n responseTime,\n contentLength: getContentLength(c),\n userAgent: getUserAgent(c),\n referrer: getReferrer(c),\n };\n}\n\n/**\n * Build request context fields from a request.\n */\nfunction buildIncludedContext(\n c: HonoContext,\n resolvedRequestId: ResolvedRequestId | undefined,\n include: readonly RequestContextField[],\n): Record<string, unknown> {\n const context: Record<string, unknown> = {};\n for (const field of include) {\n switch (field) {\n case \"requestId\":\n if (resolvedRequestId != null) {\n context[resolvedRequestId.property] = resolvedRequestId.value;\n }\n break;\n case \"method\":\n context.method = c.req.method;\n break;\n case \"url\":\n context.url = c.req.url;\n break;\n case \"path\":\n context.path = c.req.path;\n break;\n case \"userAgent\":\n context.userAgent = getUserAgent(c);\n break;\n case \"remoteAddr\":\n context.remoteAddr = getRemoteAddr(c);\n break;\n case \"referrer\":\n context.referrer = getReferrer(c);\n break;\n }\n }\n return context;\n}\n\n/**\n * Build the implicit context for a request.\n */\nasync function buildRequestContext(\n c: HonoContext,\n options: RequestContextOptions,\n): Promise<HonoRequestContextState> {\n const requestIdOptions = normalizeRequestIdOptions(options.requestId);\n const resolvedRequestId = requestIdOptions == null\n ? undefined\n : resolveRequestId(c, requestIdOptions);\n const include = options.include ??\n (resolvedRequestId == null ? [] : [\"requestId\"] as const);\n const context = buildIncludedContext(c, resolvedRequestId, include);\n if (options.enrich != null) Object.assign(context, await options.enrich(c));\n const responseHeader = resolvedRequestId?.responseHeader == null\n ? undefined\n : {\n name: resolvedRequestId.responseHeader,\n value: resolvedRequestId.value,\n };\n return { context, responseHeader };\n}\n\n/**\n * Apply deferred context response headers to the final Hono response.\n */\nfunction applyResponseHeaders(\n c: HonoContext,\n requestContext: HonoRequestContextState,\n): void {\n if (requestContext.responseHeader == null) return;\n try {\n c.header(\n requestContext.responseHeader.name,\n requestContext.responseHeader.value,\n );\n } catch {\n // Keep logging middleware from replacing the application's response.\n }\n}\n\n/**\n * Add request context fields to a request log result.\n */\nfunction withRequestLogContext(\n result: string | Record<string, unknown>,\n context: Record<string, unknown>,\n): string | Record<string, unknown> {\n if (typeof result === \"string\") return result;\n return { ...result, ...context };\n}\n\n/**\n * Combined format (Apache Combined Log Format).\n * Returns all structured properties.\n */\nfunction formatCombined(\n c: HonoContext,\n responseTime: number,\n): Record<string, unknown> {\n return { ...buildProperties(c, responseTime) };\n}\n\n/**\n * Common format (Apache Common Log Format).\n * Like combined but without referrer and userAgent.\n */\nfunction formatCommon(\n c: HonoContext,\n responseTime: number,\n): Record<string, unknown> {\n const props = buildProperties(c, responseTime);\n const { referrer: _referrer, userAgent: _userAgent, ...rest } = props;\n return rest;\n}\n\n/**\n * Dev format (colored output for development).\n * :method :path :status :response-time ms - :res[content-length]\n */\nfunction formatDev(\n c: HonoContext,\n responseTime: number,\n): string {\n const contentLength = getContentLength(c) ?? \"-\";\n return `${c.req.method} ${c.req.path} ${c.res.status} ${\n responseTime.toFixed(3)\n } ms - ${contentLength}`;\n}\n\n/**\n * Short format.\n * :method :url :status :res[content-length] - :response-time ms\n */\nfunction formatShort(\n c: HonoContext,\n responseTime: number,\n): string {\n const contentLength = getContentLength(c) ?? \"-\";\n return `${c.req.method} ${c.req.url} ${c.res.status} ${contentLength} - ${\n responseTime.toFixed(3)\n } ms`;\n}\n\n/**\n * Tiny format (minimal output).\n * :method :path :status :res[content-length] - :response-time ms\n */\nfunction formatTiny(\n c: HonoContext,\n responseTime: number,\n): string {\n const contentLength = getContentLength(c) ?? \"-\";\n return `${c.req.method} ${c.req.path} ${c.res.status} ${contentLength} - ${\n responseTime.toFixed(3)\n } ms`;\n}\n\n/**\n * Map of predefined format functions.\n */\nconst predefinedFormats: Record<PredefinedFormat, FormatFunction> = {\n combined: formatCombined,\n common: formatCommon,\n dev: formatDev,\n short: formatShort,\n tiny: formatTiny,\n};\n\n/**\n * Normalize category to array format.\n */\nfunction normalizeCategory(\n category: string | readonly string[],\n): readonly string[] {\n return typeof category === \"string\" ? [category] : category;\n}\n\n/**\n * Creates Hono middleware for HTTP request logging using LogTape.\n *\n * This middleware provides Morgan-compatible request logging with LogTape\n * as the backend, supporting structured logging and customizable formats.\n *\n * @example Basic usage\n * ```typescript\n * import { Hono } from \"hono\";\n * import { configure, getConsoleSink } from \"@logtape/logtape\";\n * import { honoLogger } from \"@logtape/hono\";\n *\n * await configure({\n * sinks: { console: getConsoleSink() },\n * loggers: [\n * { category: [\"hono\"], sinks: [\"console\"], lowestLevel: \"info\" }\n * ],\n * });\n *\n * const app = new Hono();\n * app.use(honoLogger());\n *\n * app.get(\"/\", (c) => c.json({ hello: \"world\" }));\n *\n * export default app;\n * ```\n *\n * @example With custom options\n * ```typescript\n * app.use(honoLogger({\n * category: [\"myapp\", \"http\"],\n * level: \"debug\",\n * format: \"dev\",\n * skip: (c) => c.req.path === \"/health\",\n * }));\n * ```\n *\n * @example With custom format function\n * ```typescript\n * app.use(honoLogger({\n * format: (c, responseTime) => ({\n * method: c.req.method,\n * path: c.req.path,\n * status: c.res.status,\n * duration: responseTime,\n * }),\n * }));\n * ```\n *\n * @param options Configuration options for the middleware.\n * @returns Hono middleware function.\n * @since 1.3.0\n */\nexport function honoLogger(\n options: HonoLogTapeOptions = {},\n): MiddlewareHandler {\n const category = normalizeCategory(options.category ?? [\"hono\"]);\n const logger = getLogger(category);\n const level = options.level ?? \"info\";\n const formatOption = options.format ?? \"combined\";\n const skip = options.skip ?? (() => false);\n const logRequest = options.logRequest ?? false;\n const contextOptions = normalizeRequestContextOptions(options.context);\n\n // Resolve format function\n const formatFn: FormatFunction = typeof formatOption === \"string\"\n ? predefinedFormats[formatOption]\n : formatOption;\n\n const logMethod = logger[level].bind(logger);\n\n return createMiddleware(async (c, next) => {\n const startTime = Date.now();\n const honoContext = c as unknown as HonoContext;\n\n const handleRequest = async (\n requestContextState: HonoRequestContextState,\n ): Promise<void> => {\n const requestContext = requestContextState.context;\n // For immediate logging, log when request arrives\n if (logRequest) {\n if (!skip(honoContext)) {\n const result = withRequestLogContext(\n formatFn(honoContext, 0),\n requestContext,\n );\n if (typeof result === \"string\") {\n logMethod(result, requestContext);\n } else {\n logMethod(\"{method} {url}\", result);\n }\n }\n await next();\n applyResponseHeaders(honoContext, requestContextState);\n return;\n }\n\n // Log after response is sent\n await next();\n applyResponseHeaders(honoContext, requestContextState);\n\n if (skip(honoContext)) return;\n\n const responseTime = Date.now() - startTime;\n const result = withRequestLogContext(\n formatFn(honoContext, responseTime),\n requestContext,\n );\n\n if (typeof result === \"string\") {\n logMethod(result, requestContext);\n } else {\n logMethod(\"{method} {url} {status} - {responseTime} ms\", result);\n }\n };\n\n if (contextOptions == null) {\n await handleRequest({ context: {} });\n return;\n }\n\n const requestContextState = await buildRequestContext(\n honoContext,\n contextOptions,\n );\n await withContext(\n requestContextState.context,\n () => handleRequest(requestContextState),\n );\n });\n}\n"],"mappings":";;;;AA8MA,MAAM,yBAAyB;;;;AAmB/B,SAAS,+BACPA,SACmC;AACnC,KAAI,YAAY,KAAM,QAAO,CAAE;AAC/B,KAAI,YAAY,SAAS,WAAW,KAAM;AAC1C,QAAO;AACR;;;;AAKD,SAAS,0BACPC,SAC8B;AAC9B,KAAI,YAAY,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Aa,aAAa,EACnC,eACD;AAED,cAAW,WAAW,SACpB,WAAU,QAAQ,eAAe;OAEjC,WAAU,+CAA+C,OAAO;EAEnE;AAED,MAAI,kBAAkB,MAAM;AAC1B,SAAM,cAAc,EAAE,SAAS,CAAE,EAAE,EAAC;AACpC;EACD;EAED,MAAM,sBAAsB,MAAM,oBAChC,aACA,eACD;AACD,QAAM,YACJ,oBAAoB,SACpB,MAAM,cAAc,oBAAoB,CACzC;CACF,EAAC;AACH"}
1
+ {"version":3,"file":"mod.js","names":["options: boolean | RequestContextOptions | undefined","options: boolean | RequestIdOptions | undefined","value: string","c: HonoContext","options: RequestIdOptions","responseHeader","responseTime: number","resolvedRequestId: ResolvedRequestId | undefined","include: readonly RequestContextField[]","context: Record<string, unknown>","options: RequestContextOptions","requestContext: HonoRequestContextState","result: string | Record<string, unknown>","predefinedFormats: Record<PredefinedFormat, FormatFunction>","category: string | readonly string[]","options: HonoLogTapeOptions","formatFn: FormatFunction","requestContextState: HonoRequestContextState","requestContextState","result"],"sources":["../src/mod.ts"],"sourcesContent":["import { getLogger, type LogLevel, withContext } from \"@logtape/logtape\";\nimport { createMiddleware } from \"hono/factory\";\nimport type { Context, MiddlewareHandler } from \"hono\";\n\nexport type { LogLevel } from \"@logtape/logtape\";\n\n/**\n * Hono context interface exposed to custom formatters and skip callbacks.\n *\n * This matches the actual runtime object passed to the middleware, so custom\n * formatters can access context variables via methods like `c.get()` when\n * needed.\n * @since 1.3.0\n */\n// deno-lint-ignore no-explicit-any\nexport interface HonoContext extends Context<any, any, any> {}\n\n/**\n * Predefined log format names compatible with Morgan.\n * @since 1.3.0\n */\nexport type PredefinedFormat = \"combined\" | \"common\" | \"dev\" | \"short\" | \"tiny\";\n\n/**\n * Custom format function for request logging.\n *\n * @param c The Hono context object.\n * @param responseTime The response time in milliseconds.\n * @returns A string message or an object with structured properties.\n * @since 1.3.0\n */\nexport type FormatFunction = (\n c: HonoContext,\n responseTime: number,\n) => string | Record<string, unknown>;\n\n/**\n * Structured log properties for HTTP requests.\n * @since 1.3.0\n */\nexport interface RequestLogProperties {\n /** HTTP request method */\n method: string;\n /** Request URL */\n url: string;\n /** Request path */\n path: string;\n /** HTTP response status code */\n status: number;\n /** Response time in milliseconds */\n responseTime: number;\n /** Response content-length header value */\n contentLength: string | undefined;\n /** User-Agent header value */\n userAgent: string | undefined;\n /** Referrer header value */\n referrer: string | undefined;\n}\n\n/**\n * Request fields that can be added to the implicit request context.\n * @since 2.2.0\n */\nexport type RequestContextField =\n | \"requestId\"\n | \"method\"\n | \"url\"\n | \"path\"\n | \"userAgent\"\n | \"remoteAddr\"\n | \"referrer\";\n\n/**\n * Options for extracting, generating, and propagating a request ID.\n * @since 2.2.0\n */\nexport interface RequestIdOptions {\n /**\n * The property name used in implicit context and request log records.\n * @default \"requestId\"\n */\n readonly property?: string;\n\n /**\n * Incoming request headers to inspect in order.\n * @default [\"x-request-id\"]\n */\n readonly headerNames?: readonly string[];\n\n /**\n * Response header that receives the resolved request ID.\n * Set to `false` to disable response header propagation.\n * @default \"x-request-id\"\n */\n readonly responseHeader?: string | false;\n\n /**\n * Generates a request ID when no incoming header is present.\n * @default crypto.randomUUID()\n */\n readonly generate?: () => string;\n\n /**\n * Normalizes an incoming request ID. Return `null` to reject the value and\n * keep looking for another header or generate a new ID.\n */\n readonly normalize?: (value: string) => string | null;\n}\n\n/**\n * Options for request-scoped implicit context.\n * @since 2.2.0\n */\nexport interface RequestContextOptions {\n /**\n * Enables request ID extraction, generation, and response propagation.\n * @default true\n */\n readonly requestId?: boolean | RequestIdOptions;\n\n /**\n * Fields to add to the implicit context.\n * @default [\"requestId\"]\n */\n readonly include?: readonly RequestContextField[];\n\n /**\n * Adds application-specific fields to the implicit request context.\n */\n readonly enrich?: (\n c: HonoContext,\n ) => Record<string, unknown> | Promise<Record<string, unknown>>;\n}\n\n/**\n * Options for configuring the Hono LogTape middleware.\n * @since 1.3.0\n */\nexport interface HonoLogTapeOptions {\n /**\n * The LogTape category to use for logging.\n * @default [\"hono\"]\n */\n readonly category?: string | readonly string[];\n\n /**\n * The log level to use for request logging.\n * @default \"info\"\n */\n readonly level?: LogLevel;\n\n /**\n * The format for log output.\n * Can be a predefined format name or a custom format function.\n *\n * Predefined formats:\n * - `\"combined\"` - Apache Combined Log Format (structured, default)\n * - `\"common\"` - Apache Common Log Format (structured, no referrer/userAgent)\n * - `\"dev\"` - Concise colored output for development (string)\n * - `\"short\"` - Shorter than common (string)\n * - `\"tiny\"` - Minimal output (string)\n *\n * @default \"combined\"\n */\n readonly format?: PredefinedFormat | FormatFunction;\n\n /**\n * Function to determine whether logging should be skipped.\n * Return `true` to skip logging for a request.\n *\n * @example Skip logging for health check endpoint\n * ```typescript\n * app.use(honoLogger({\n * skip: (c) => c.req.path === \"/health\",\n * }));\n * ```\n *\n * @default () => false\n */\n readonly skip?: (c: HonoContext) => boolean;\n\n /**\n * If `true`, logs are written immediately when the request is received.\n * If `false` (default), logs are written after the response is sent.\n *\n * Note: When `logRequest` is `true`, response-related properties\n * (status, responseTime, contentLength) will not be available.\n *\n * @default false\n */\n readonly logRequest?: boolean;\n\n /**\n * Enables request-scoped implicit context and request ID correlation.\n *\n * When set to `true`, the middleware reads the `x-request-id` header,\n * generates one when it is absent, writes it to the `x-request-id` response\n * header, and adds `requestId` to all LogTape records emitted while handling\n * the request.\n *\n * @default false\n * @since 2.2.0\n */\n readonly context?: boolean | RequestContextOptions;\n}\n\nconst defaultRequestIdHeader = \"x-request-id\";\n\ninterface ResolvedRequestId {\n readonly property: string;\n readonly value: string;\n readonly responseHeader?: string;\n}\n\ninterface HonoRequestContextState {\n readonly context: Record<string, unknown>;\n readonly responseHeader?: {\n readonly name: string;\n readonly value: string;\n };\n}\n\n/**\n * Normalize request context options.\n */\nfunction normalizeRequestContextOptions(\n options: boolean | RequestContextOptions | undefined,\n): RequestContextOptions | undefined {\n if (options === true) return {};\n if (options === false || options == null) return undefined;\n return options;\n}\n\n/**\n * Normalize request ID options.\n */\nfunction normalizeRequestIdOptions(\n options: boolean | RequestIdOptions | undefined,\n): RequestIdOptions | undefined {\n if (options === false) return undefined;\n if (options === true || options == null) return {};\n return options;\n}\n\n/**\n * Generate a request ID with Web Crypto when possible.\n */\nfunction generateRequestId(): string {\n if (typeof globalThis.crypto?.randomUUID === \"function\") {\n return globalThis.crypto.randomUUID();\n }\n return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`;\n}\n\n/**\n * Normalize an incoming request ID.\n */\nfunction defaultNormalizeRequestId(value: string): string | null {\n const trimmed = value.trim();\n return trimmed === \"\" ? null : trimmed;\n}\n\n/**\n * Resolve the request ID for a request.\n */\nfunction resolveRequestId(\n c: HonoContext,\n options: RequestIdOptions,\n): ResolvedRequestId {\n const property = options.property ?? \"requestId\";\n const normalize = options.normalize ?? defaultNormalizeRequestId;\n const headerNames = options.headerNames ?? [defaultRequestIdHeader];\n for (const headerName of headerNames) {\n const headerValue = c.req.header(headerName);\n if (headerValue == null) continue;\n const normalized = normalize(headerValue);\n if (normalized != null) {\n const responseHeader = options.responseHeader ?? defaultRequestIdHeader;\n return {\n property,\n value: normalized,\n responseHeader: responseHeader === false ? undefined : responseHeader,\n };\n }\n }\n const generated = (options.generate ?? generateRequestId)();\n const responseHeader = options.responseHeader ?? defaultRequestIdHeader;\n return {\n property,\n value: generated,\n responseHeader: responseHeader === false ? undefined : responseHeader,\n };\n}\n\n/**\n * Get referrer from request headers.\n */\nfunction getReferrer(c: HonoContext): string | undefined {\n return c.req.header(\"referrer\") || c.req.header(\"referer\");\n}\n\n/**\n * Get user agent from request headers.\n */\nfunction getUserAgent(c: HonoContext): string | undefined {\n return c.req.header(\"user-agent\");\n}\n\n/**\n * Get remote address from X-Forwarded-For header.\n */\nfunction getRemoteAddr(c: HonoContext): string | undefined {\n const forwarded = c.req.header(\"x-forwarded-for\");\n if (forwarded == null) return undefined;\n const firstIp = forwarded.split(\",\")[0].trim();\n return firstIp || undefined;\n}\n\n/**\n * Get content length from response headers.\n */\nfunction getContentLength(c: HonoContext): string | undefined {\n const contentLength = c.res.headers.get(\"content-length\");\n if (contentLength === null) return undefined;\n return contentLength;\n}\n\n/**\n * Build structured log properties from context.\n */\nfunction buildProperties(\n c: HonoContext,\n responseTime: number,\n): RequestLogProperties {\n return {\n method: c.req.method,\n url: c.req.url,\n path: c.req.path,\n status: c.res.status,\n responseTime,\n contentLength: getContentLength(c),\n userAgent: getUserAgent(c),\n referrer: getReferrer(c),\n };\n}\n\n/**\n * Build request context fields from a request.\n */\nfunction buildIncludedContext(\n c: HonoContext,\n resolvedRequestId: ResolvedRequestId | undefined,\n include: readonly RequestContextField[],\n): Record<string, unknown> {\n const context: Record<string, unknown> = {};\n for (const field of include) {\n switch (field) {\n case \"requestId\":\n if (resolvedRequestId != null) {\n context[resolvedRequestId.property] = resolvedRequestId.value;\n }\n break;\n case \"method\":\n context.method = c.req.method;\n break;\n case \"url\":\n context.url = c.req.url;\n break;\n case \"path\":\n context.path = c.req.path;\n break;\n case \"userAgent\":\n context.userAgent = getUserAgent(c);\n break;\n case \"remoteAddr\":\n context.remoteAddr = getRemoteAddr(c);\n break;\n case \"referrer\":\n context.referrer = getReferrer(c);\n break;\n }\n }\n return context;\n}\n\n/**\n * Build the implicit context for a request.\n */\nasync function buildRequestContext(\n c: HonoContext,\n options: RequestContextOptions,\n): Promise<HonoRequestContextState> {\n const requestIdOptions = normalizeRequestIdOptions(options.requestId);\n const resolvedRequestId = requestIdOptions == null\n ? undefined\n : resolveRequestId(c, requestIdOptions);\n const include = options.include ??\n (resolvedRequestId == null ? [] : [\"requestId\"] as const);\n const context = buildIncludedContext(c, resolvedRequestId, include);\n if (options.enrich != null) Object.assign(context, await options.enrich(c));\n const responseHeader = resolvedRequestId?.responseHeader == null\n ? undefined\n : {\n name: resolvedRequestId.responseHeader,\n value: resolvedRequestId.value,\n };\n return { context, responseHeader };\n}\n\n/**\n * Apply deferred context response headers to the final Hono response.\n */\nfunction applyResponseHeaders(\n c: HonoContext,\n requestContext: HonoRequestContextState,\n): void {\n if (requestContext.responseHeader == null) return;\n try {\n c.header(\n requestContext.responseHeader.name,\n requestContext.responseHeader.value,\n );\n } catch {\n // Keep logging middleware from replacing the application's response.\n }\n}\n\n/**\n * Add request context fields to a request log result.\n */\nfunction withRequestLogContext(\n result: string | Record<string, unknown>,\n context: Record<string, unknown>,\n): string | Record<string, unknown> {\n if (typeof result === \"string\") return result;\n return { ...result, ...context };\n}\n\n/**\n * Combined format (Apache Combined Log Format).\n * Returns all structured properties.\n */\nfunction formatCombined(\n c: HonoContext,\n responseTime: number,\n): Record<string, unknown> {\n return { ...buildProperties(c, responseTime) };\n}\n\n/**\n * Common format (Apache Common Log Format).\n * Like combined but without referrer and userAgent.\n */\nfunction formatCommon(\n c: HonoContext,\n responseTime: number,\n): Record<string, unknown> {\n const props = buildProperties(c, responseTime);\n const { referrer: _referrer, userAgent: _userAgent, ...rest } = props;\n return rest;\n}\n\n/**\n * Dev format (colored output for development).\n * :method :path :status :response-time ms - :res[content-length]\n */\nfunction formatDev(\n c: HonoContext,\n responseTime: number,\n): string {\n const contentLength = getContentLength(c) ?? \"-\";\n return `${c.req.method} ${c.req.path} ${c.res.status} ${\n responseTime.toFixed(3)\n } ms - ${contentLength}`;\n}\n\n/**\n * Short format.\n * :method :url :status :res[content-length] - :response-time ms\n */\nfunction formatShort(\n c: HonoContext,\n responseTime: number,\n): string {\n const contentLength = getContentLength(c) ?? \"-\";\n return `${c.req.method} ${c.req.url} ${c.res.status} ${contentLength} - ${\n responseTime.toFixed(3)\n } ms`;\n}\n\n/**\n * Tiny format (minimal output).\n * :method :path :status :res[content-length] - :response-time ms\n */\nfunction formatTiny(\n c: HonoContext,\n responseTime: number,\n): string {\n const contentLength = getContentLength(c) ?? \"-\";\n return `${c.req.method} ${c.req.path} ${c.res.status} ${contentLength} - ${\n responseTime.toFixed(3)\n } ms`;\n}\n\n/**\n * Map of predefined format functions.\n */\nconst predefinedFormats: Record<PredefinedFormat, FormatFunction> = {\n combined: formatCombined,\n common: formatCommon,\n dev: formatDev,\n short: formatShort,\n tiny: formatTiny,\n};\n\n/**\n * Normalize category to array format.\n */\nfunction normalizeCategory(\n category: string | readonly string[],\n): readonly string[] {\n return typeof category === \"string\" ? [category] : category;\n}\n\n/**\n * Creates Hono middleware for HTTP request logging using LogTape.\n *\n * This middleware provides Morgan-compatible request logging with LogTape\n * as the backend, supporting structured logging and customizable formats.\n *\n * @example Basic usage\n * ```typescript\n * import { Hono } from \"hono\";\n * import { configure, getConsoleSink } from \"@logtape/logtape\";\n * import { honoLogger } from \"@logtape/hono\";\n *\n * await configure({\n * sinks: { console: getConsoleSink() },\n * loggers: [\n * { category: [\"hono\"], sinks: [\"console\"], lowestLevel: \"info\" }\n * ],\n * });\n *\n * const app = new Hono();\n * app.use(honoLogger());\n *\n * app.get(\"/\", (c) => c.json({ hello: \"world\" }));\n *\n * export default app;\n * ```\n *\n * @example With custom options\n * ```typescript\n * app.use(honoLogger({\n * category: [\"myapp\", \"http\"],\n * level: \"debug\",\n * format: \"dev\",\n * skip: (c) => c.req.path === \"/health\",\n * }));\n * ```\n *\n * @example With custom format function\n * ```typescript\n * app.use(honoLogger({\n * format: (c, responseTime) => ({\n * method: c.req.method,\n * path: c.req.path,\n * status: c.res.status,\n * duration: responseTime,\n * }),\n * }));\n * ```\n *\n * @param options Configuration options for the middleware.\n * @returns Hono middleware function.\n * @since 1.3.0\n */\nexport function honoLogger(\n options: HonoLogTapeOptions = {},\n): MiddlewareHandler {\n const category = normalizeCategory(options.category ?? [\"hono\"]);\n const logger = getLogger(category);\n const level = options.level ?? \"info\";\n const formatOption = options.format ?? \"combined\";\n const skip = options.skip ?? (() => false);\n const logRequest = options.logRequest ?? false;\n const contextOptions = normalizeRequestContextOptions(options.context);\n\n // Resolve format function\n const formatFn: FormatFunction = typeof formatOption === \"string\"\n ? predefinedFormats[formatOption]\n : formatOption;\n\n const logMethod = logger[level].bind(logger);\n\n return createMiddleware(async (c, next) => {\n const startTime = Date.now();\n const honoContext = c as unknown as HonoContext;\n\n const handleRequest = async (\n requestContextState: HonoRequestContextState,\n ): Promise<void> => {\n const requestContext = requestContextState.context;\n applyResponseHeaders(honoContext, requestContextState);\n // For immediate logging, log when request arrives\n if (logRequest) {\n if (!skip(honoContext)) {\n const result = withRequestLogContext(\n formatFn(honoContext, 0),\n requestContext,\n );\n if (typeof result === \"string\") {\n logMethod(result, requestContext);\n } else {\n logMethod(\"{method} {url}\", result);\n }\n }\n await next();\n applyResponseHeaders(honoContext, requestContextState);\n return;\n }\n\n // Log after response is sent\n await next();\n applyResponseHeaders(honoContext, requestContextState);\n\n if (skip(honoContext)) return;\n\n const responseTime = Date.now() - startTime;\n const result = withRequestLogContext(\n formatFn(honoContext, responseTime),\n requestContext,\n );\n\n if (typeof result === \"string\") {\n logMethod(result, requestContext);\n } else {\n logMethod(\"{method} {url} {status} - {responseTime} ms\", result);\n }\n };\n\n if (contextOptions == null) {\n await handleRequest({ context: {} });\n return;\n }\n\n const requestContextState = await buildRequestContext(\n honoContext,\n contextOptions,\n );\n await withContext(\n requestContextState.context,\n () => handleRequest(requestContextState),\n );\n });\n}\n"],"mappings":";;;;AA8MA,MAAM,yBAAyB;;;;AAmB/B,SAAS,+BACPA,SACmC;AACnC,KAAI,YAAY,KAAM,QAAO,CAAE;AAC/B,KAAI,YAAY,SAAS,WAAW,KAAM;AAC1C,QAAO;AACR;;;;AAKD,SAAS,0BACPC,SAC8B;AAC9B,KAAI,YAAY,MAAO;AACvB,KAAI,YAAY,QAAQ,WAAW,KAAM,QAAO,CAAE;AAClD,QAAO;AACR;;;;AAKD,SAAS,oBAA4B;AACnC,YAAW,WAAW,QAAQ,eAAe,WAC3C,QAAO,WAAW,OAAO,YAAY;AAEvC,SAAQ,EAAE,KAAK,KAAK,CAAC,SAAS,GAAG,CAAC,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,CAAC;AAC1E;;;;AAKD,SAAS,0BAA0BC,OAA8B;CAC/D,M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AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logtape/hono",
3
- "version": "2.2.0-dev.702+4879c273",
3
+ "version": "2.2.0-dev.708+280ccb86",
4
4
  "description": "Hono adapter for LogTape logging library",
5
5
  "keywords": [
6
6
  "logging",
@@ -55,7 +55,7 @@
55
55
  ],
56
56
  "peerDependencies": {
57
57
  "hono": "^4.0.0",
58
- "@logtape/logtape": "^2.2.0-dev.702+4879c273"
58
+ "@logtape/logtape": "^2.2.0-dev.708+280ccb86"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@alinea/suite": "^0.6.3",