Skip to content

Compile-time logging_for for applications with a hand-written Hooks impl #504

Description

@aram356

Summary

An application that implements Hooks by hand has no compile-time way to return the manifest's logging configuration from Hooks::logging_for. Only app! bakes it.

Behavior today

  • app! generates logging_for from [adapters.*.logging] at compile time (crates/edgezero-macros/src/app.rs, build_logging_tokens).
  • app! also generates the routes from manifest triggers. An application whose routes are not manifest triggers therefore writes its own Hooks impl, as Trusted Server does on all four adapters, and loses the baked table. Its only options are to parse edgezero.toml at runtime with ManifestLoader::load_from_str, or to copy the values into code.
  • On Fastly, the managed setup calls logging_for before every callback. A non-reusable instance serves one request, so a runtime parse happens on every request, health checks included.

Acceptance criteria

  • A hand-written Hooks impl can return the manifest's logging configuration for an adapter with no runtime parse and no copied values.
  • The result equals what app! generates for the same manifest.
  • The adapter guides document it.

Related

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions