Add feature flag to enable all log levels in examples (#98)

- Adds extra troubleshooting documentation to the README
This commit is contained in:
Jay Oster 2020-07-18 23:00:26 -07:00 committed by GitHub
parent 7e38a7262d
commit b5b55c43f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 5 deletions

View file

@ -36,6 +36,27 @@ requests a low power (aka integrated) GPU by default. If the examples are not wo
You should also try to keep your graphics drivers up-to-date, especially if you have an old Intel integrated GPU. Keep in mind that some drivers and GPUs are EOL and will not be supported. You should also try to keep your graphics drivers up-to-date, especially if you have an old Intel integrated GPU. Keep in mind that some drivers and GPUs are EOL and will not be supported.
### Logging
You may want to use the `RUST_LOG` environment variable (see [`env_logger`](https://docs.rs/env_logger) for full documentation) to gain additional insight while troubleshooting the examples. `RUST_LOG=trace` will spew all logs to `stderr` on debug builds:
```
$ RUST_LOG=trace cargo run --package minimal-winit
```
And also on release builds when default features are disabled:
```
$ cd examples/minimal-winit
$ RUST_LOG=trace cargo run --release --no-default-features
```
Alternatively, nightly Cargo allows using the `--no-default-features` flag directly from the top-level directory in combination with the unstable `-Zpackage-features` flag:
```
$ RUST_LOG=trace cargo run --release --package minimal-winit -Zpackage-features --no-default-features
```
## Comparison with `minifb` ## Comparison with `minifb`
The [`minifb`](https://crates.io/crates/minifb) crate shares some similarities with `pixels`; it also allows rapid prototyping of 2D games and emulators. But it requires the use of its own window/GUI management, event loop, and input handling. One of the disadvantages with the `minifb` approach is the lack of hardware acceleration (except on macOS, which uses Metal but is not configurable). An advantage is that it relies on fewer dependencies. The [`minifb`](https://crates.io/crates/minifb) crate shares some similarities with `pixels`; it also allows rapid prototyping of 2D games and emulators. But it requires the use of its own window/GUI management, event loop, and input handling. One of the disadvantages with the `minifb` approach is the lack of hardware acceleration (except on macOS, which uses Metal but is not configurable). An advantage is that it relies on fewer dependencies.

View file

@ -5,12 +5,16 @@ authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2018" edition = "2018"
publish = false publish = false
[features]
optimize = ["log/release_max_level_warn"]
default = ["optimize"]
[dependencies] [dependencies]
byteorder = "1.3.4" byteorder = "1.3.4"
env_logger = "0.7.1" env_logger = "0.7.1"
getrandom = "0.1.14" getrandom = "0.1.14"
line_drawing = "0.8.0" line_drawing = "0.8.0"
log = { version = "0.4.8", features = [ "release_max_level_warn" ] } log = "0.4.8"
pixels = { path = "../.." } pixels = { path = "../.." }
randomize = "3.0.1" randomize = "3.0.1"
winit = "0.22.0" winit = "0.22.0"

View file

@ -5,12 +5,16 @@ authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2018" edition = "2018"
publish = false publish = false
[features]
optimize = ["log/release_max_level_warn"]
default = ["optimize"]
[dependencies] [dependencies]
byteorder = "1.3.4" byteorder = "1.3.4"
env_logger = "0.7.1" env_logger = "0.7.1"
getrandom = "0.1.14" getrandom = "0.1.14"
gilrs = "0.7.4" gilrs = "0.7.4"
log = { version = "0.4.8", features = [ "release_max_level_warn" ] } log = "0.4.8"
pixels = { path = "../.." } pixels = { path = "../.." }
randomize = "3.0.1" randomize = "3.0.1"
simple-invaders = { path = "simple-invaders" } simple-invaders = { path = "simple-invaders" }

View file

@ -5,8 +5,12 @@ authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2018" edition = "2018"
publish = false publish = false
[features]
optimize = ["log/release_max_level_warn"]
default = ["optimize"]
[dependencies] [dependencies]
beryllium = { version = "0.2.1", features = [ "extern_crate_raw_window_handle" ] } beryllium = { version = "0.2.1", features = ["extern_crate_raw_window_handle"] }
env_logger = "0.7.1" env_logger = "0.7.1"
log = { version = "0.4.8", features = [ "release_max_level_warn" ] } log = "0.4.8"
pixels = { path = "../.." } pixels = { path = "../.." }

View file

@ -5,9 +5,13 @@ authors = ["Jay Oster <jay@kodewerx.org>"]
edition = "2018" edition = "2018"
publish = false publish = false
[features]
optimize = ["log/release_max_level_warn"]
default = ["optimize"]
[dependencies] [dependencies]
env_logger = "0.7.1" env_logger = "0.7.1"
log = { version = "0.4.8", features = [ "release_max_level_warn" ] } log = "0.4.8"
pixels = { path = "../.." } pixels = { path = "../.." }
winit = "0.22.0" winit = "0.22.0"
winit_input_helper = "0.6.0" winit_input_helper = "0.6.0"