| Crates.io | actix-slog |
| lib.rs | actix-slog |
| version | 0.2.1 |
| created_at | 2020-07-06 15:50:26.507829+00 |
| updated_at | 2020-09-25 20:42:01.7399+00 |
| description | structured access-logging for actix-web utilizing slog, thus enabling JSON-logging |
| homepage | https://github.com/elmarx/actix-slog |
| repository | https://github.com/elmarx/actix-slog |
| max_upload_size | |
| id | 262002 |
| size | 75,020 |
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.
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")