#worker #cloudflare-workers

tracing-worker

tracing-subscriber implementation for Cloudflare Workers worker crate

10 releases

0.1.9 Apr 6, 2023
0.1.8 Apr 6, 2023

#15 in #cloudflare-workers

Download history 1/week @ 2024-07-29 7/week @ 2024-09-23 3/week @ 2024-09-30

108 downloads per month

Apache-2.0

7KB
58 lines

tracing-worker

tracing_subscriber implementation for Cloudflare Workers' workers.rs crate.

This is an independent open-source implementation, not affiliated with Cloudflare.

Add as a dependency

cargo add tracing-worker

Initialize

pub async fn main(req: Request, env: Env, _ctx: worker::Context) -> Result<Response> {
    tracing_worker::init(&env);
    (...)

Tracing records will now be printed to the console:

$ wrangler dev
Thu Apr 06 2023 09:24:09 GMT+0000  INFO country_counter: [/], located at: (52.2296, 21.0067), within: Mazovia (event src/lib.rs:10)
Thu Apr 06 2023 09:24:09 GMT+0000 DEBUG libsql_client::workers: Stream opened (event /home/sarna/.cargo/registry/src/github.com-1ecc6299db9ec823/libsql-client-0.22.3/src/workers.rs:78)

Dependencies

~15–25MB
~353K SLoC