#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

#1028 in HTTP server

Download history 37/week @ 2024-04-08 32/week @ 2024-04-15 36/week @ 2024-04-22 16/week @ 2024-04-29 16/week @ 2024-05-06 28/week @ 2024-05-13 26/week @ 2024-05-20 29/week @ 2024-05-27 24/week @ 2024-06-03 18/week @ 2024-06-10 44/week @ 2024-06-17 28/week @ 2024-06-24 8/week @ 2024-07-01 17/week @ 2024-07-08 16/week @ 2024-07-15 43/week @ 2024-07-22

85 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
~609K SLoC