1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-24 16:02:59 +01:00

add logger info

This commit is contained in:
Nikolay Kim 2018-02-20 12:49:42 -08:00
parent 2374aa42ed
commit 7198dde465

View File

@ -64,7 +64,9 @@ Active provides several useful middlewares, like *logging*, *user sessions*, etc
Logging is implemented as middleware.
It is common to register logging middleware as first middleware for application.
Logging middleware has to be registered for each application.
Logging middleware has to be registered for each application. *Logger* middleware
uses standard log crate to log information. You should enable logger for *actix_web*
package to see access log. ([env_logger](https://docs.rs/env_logger/*/env_logger/) or similar)
### Usage
@ -76,10 +78,14 @@ Default `Logger` could be created with `default` method, it uses the default for
```
```rust
# extern crate actix_web;
extern crate env_logger;
use actix_web::Application;
use actix_web::middleware::Logger;
fn main() {
std::env::set_var("RUST_LOG", "actix_web=info");
env_logger::init();
Application::new()
.middleware(Logger::default())
.middleware(Logger::new("%a %{User-Agent}i"))