Documentation
¶
Overview ¶
Package log is the minimum an edge app must report to be operable.
The rule it enforces: no response of 400 or worse leaves the Worker without a line saying why. A bare status code in a dashboard tells the operator that something broke, never what — and at the edge there is no shell to go and look.
It is deliberately small. Successful requests are NOT logged: Cloudflare already records every request with its method, path and status, so an access log here would only duplicate it, cost CPU on the hot path and bury the lines that matter.
Never pass a request body, a header or a cookie to these functions. Logs are read by people and shipped to third parties; a body can carry credentials or personal data.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fail ¶
Fail records a failure that is ours: a 5xx. err is the cause, and it is the whole point of the call — a 502 with no cause cannot be acted on.
func Panic ¶
Panic records a panic that was caught at the request boundary.
This is the line that must never be missing. An unrecovered panic tears down the wasm instance and Cloudflare answers 1101 "Worker threw exception" — a generic error, with the real cause nowhere to be seen. Recovering and logging turns that dead end into a 500 that names what happened.
Types ¶
This section is empty.