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

Activity

  1. added theissue type on Nov 15, 2026
  2. aram356 commented on Nov 16, 2026

    @aram356
    CollaboratorAuthor

    CREATOR: fixed in b65e7144, pushed to existing PR #275 as requested.

    Hand-written hooks can now implement:

    fn logging_for(adapter: &str) -> edgezero_core::manifest::ResolvedLoggingConfig {
        edgezero_core::logging_config!("edgezero.toml", adapter)
    }

    The expression reuses app!'s compiler-side manifest loader, validation and logging emitter. It does not generate routes or parse configuration at runtime. Adapter lookup is evaluated once; defaults, case folding, precedence, endpoints and validation remain shared. All four adapter guides document this path. Adapter logger ownership and runtime overrides are unchanged.

    Executed local evidence on the published source tree:

    $ cargo test --offline --locked -p edgezero-macros --test logging_config
    test result: ok. 4 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 24.67s
    $ bash scripts/run_tests.sh
    All tests completed successfully.
    

    Both commands exited 0. The focused compiler regression was rerun on the exact pushed head; broad validation ran on the same source tree before committing. The compiler suite includes three positive consumers, nine compile-fail fixtures, differential parity with app!/ManifestLoader, caller hygiene, and a valid-to-valid-to-invalid manifest-only rebuild. Disabling only dependency tracking reproduced stale values; restoring it passed the same regression. The executable also runs without the source manifest.

    Design and plan/evidence, including unsuccessful attempts. All primary Rust gates, strict rustdoc, adapter/fixture checks and docs checks passed locally. One earlier, unrelated-in-scope harness cancellation assertion has an unconfirmed cause; passing reruns are not claimed as a repair. Fresh CI and independent review remain pending. This issue stays open until the implementation merges; no hosted qualification is claimed.

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