#log #logging #structured #actix-web #json-logging

actix-slog

structured access-logging for actix-web utilizing slog, thus enabling JSON-logging

3 unstable releases

0.2.1 Sep 25, 2020
0.2.0 Sep 14, 2020
0.1.0 Jul 6, 2020

#238 in HTTP server

Download history 621/week @ 2021-09-25 207/week @ 2021-10-02 207/week @ 2021-10-09 171/week @ 2021-10-16 127/week @ 2021-10-23 186/week @ 2021-10-30 194/week @ 2021-11-06 184/week @ 2021-11-13 93/week @ 2021-11-20 73/week @ 2021-11-27 83/week @ 2021-12-04 80/week @ 2021-12-11 65/week @ 2021-12-18 3/week @ 2021-12-25 111/week @ 2022-01-01 119/week @ 2022-01-08

301 downloads per month
Used in pslink

MIT/Apache

23KB
199 lines

Rust build crates.io badge docs.rs badge

Structured (access-) logging for actix-web

Provides a middleware (StructuredLogger), similar to actix_web::middleware:Logger, except that it uses slog and thus enables JSON-formatted logging (via slog-json).

Of course slog's compact terminal output is a nice add-on, even if you're just out for JSON-logging.

Usage

See server_json and server_compact for working examples.

  let logger: slog::Logger = unimplemented!();

  HttpServer::new(move || {
    App::new()
      .wrap(
        StructuredLogger::new(logger.new(o!("log_type" => "access"))),
      )
    })
    .bind("[::1]:8080")

Dependencies

~23MB
~516K SLoC