Skip to content
WIP

This guide is a work in progress. Barry is also a work in progress.

@barry-rocks/sdk/logging/edge

The logger for code that runs on an edge runtime such as Cloudflare Workers, where Node’s file and process APIs aren’t available. It exposes createWorkerLogger with the same log shape as the Node logger.

import { … } from "@barry-rocks/sdk/logging/edge";

passThroughOnException(): void

void

waitUntil(promise): void

Parameter Type
promise Promise<unknown>

void


[binding: string]: unknown


Property Type Description
ctx? CloudflareExecutionContext ExecutionContext — a remote sink would flush through waitUntil.
env? WorkerLoggerEnv Worker env bindings.

createWorkerLogger(service, options?, baseContext?): Logger

Create a logger for a Cloudflare Worker.

Parameter Type
service string
options WorkerLoggerOptions
baseContext LogContext

Logger

import { createWorkerLogger } from "./emit-edge.js";
export default {
async fetch(request: Request, env: Env, ctx: ExecutionContext) {
const log = createWorkerLogger("artifacts", { env, ctx });
log.info("request.start", { path: new URL(request.url).pathname });
await log.flush();
return response;
}
};

Re-exports LogContext


Re-exports Logger


Re-exports LogLevel