@fiberplane/hono-otel
Version:
Hono middleware to forward OpenTelemetry traces to a local instance of @fiberplane/studio
16 lines (15 loc) • 931 B
TypeScript
export type FpxLogger = ReturnType<typeof getLogger>;
/**
* Get a logger that can be used to log messages to the console.
* - Optionally log depending on the FPX_LOG_LEVEL environment variable.
* - By default, log everything when in development mode, and log "warn" and above otherwise.
*
* @OPTIMIZE - This creates a new logger every time it's called.
* (But this is somewhat necessary, because the logger needs to be able to access the environment variables.
* In CF Workers, the environment variables are only available at runtime,
* and a single worker's env might get reused across requests.)
*
* @param honoEnv - The environment variables from the Hono app.
* @returns A logger object with methods for each log level
*/
export declare function getLogger(level: unknown): Record<"debug" | "info" | "warn" | "error", (message?: unknown, ...optionalParams: unknown[]) => void>;