#actix-web #structured #logging #log #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

#973 in HTTP server

Download history 12/week @ 2024-01-08 14/week @ 2024-01-15 9/week @ 2024-01-29 3/week @ 2024-02-05 30/week @ 2024-02-12 58/week @ 2024-02-19 55/week @ 2024-02-26 31/week @ 2024-03-04 37/week @ 2024-03-11 54/week @ 2024-03-18 35/week @ 2024-03-25 49/week @ 2024-04-01 37/week @ 2024-04-08 32/week @ 2024-04-15 36/week @ 2024-04-22

157 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

~29MB
~611K SLoC