Skip to content

structured logging for actix-web

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

elmarx/actix-slog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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")

About

structured logging for actix-web

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Languages