#cloudflare-workers #worker #cloudflare #tracing #tracing-subscriber #subscriber

tracing-worker

tracing-subscriber implementation for Cloudflare Workers worker crate

10 releases

0.1.9 Apr 6, 2023
0.1.8 Apr 6, 2023

#635 in Network programming

Download history 8/week @ 2024-02-26 5/week @ 2024-03-11 132/week @ 2024-04-01

137 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

~19MB
~370K SLoC