#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

#1214 in HTTP server

Download history 28/week @ 2024-11-20 26/week @ 2024-11-27 53/week @ 2024-12-04 123/week @ 2024-12-11 29/week @ 2024-12-18 47/week @ 2025-01-01 108/week @ 2025-01-08 48/week @ 2025-01-15 39/week @ 2025-01-22 34/week @ 2025-01-29 180/week @ 2025-02-05 68/week @ 2025-02-12 34/week @ 2025-02-19 55/week @ 2025-02-26 22/week @ 2025-03-05

185 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

~28–54MB
~1M SLoC