#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

#970 in HTTP server

Download history 29/week @ 2023-12-03 89/week @ 2023-12-10 17/week @ 2023-12-17 11/week @ 2024-01-07 15/week @ 2024-01-14 9/week @ 2024-01-28 2/week @ 2024-02-04 30/week @ 2024-02-11 58/week @ 2024-02-18 52/week @ 2024-02-25 31/week @ 2024-03-03 36/week @ 2024-03-10 49/week @ 2024-03-17

170 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
~605K SLoC