Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add trivial logging #48

Merged
merged 1 commit into from
Oct 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 61 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ categories = ["command-line-utilities", "science"]
actix-web = "1.0.8"
actix-service = "0.4"
actix-cors = "0.1"
env_logger = "0.7"
image = "0.19"
n5 = "0.4"
ndarray = "0.12"
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ h2n5 -h
| FLOAT32| | PNG | JPEG PNG |
| FLOAT64| | | PNG |

### Logging

Logs are output to stderr using standard Rust `log` and `env_logger` in the `actix_web` scope. By default only major errors at the `WARN` level or above are shown. For example, to show all requests:

```
RUST_LOG=actix_web=info h2n5
```

For more information, see the [`env_logger`](https://docs.rs/env_logger) and [`actix_web` logging middleware](https://actix.rs/docs/errors/) documentation.

## License

Licensed under either of
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,7 @@ mod actix_middleware_kludge {
fn main() -> std::io::Result<()> {

let opt = Options::from_args();
env_logger::init();

let mut server = HttpServer::new(
|| {
Expand All @@ -504,6 +505,7 @@ fn main() -> std::io::Result<()> {
let cors = opt.cors.clone();
App::new()
.data(opt)
.wrap(actix_web::middleware::Logger::default())
.service(
web::resource("/tile/{spec:.*}")
.route(web::get().to(tile))
Expand Down