custom_default_format.rs |
!
Disabling parts of the default format.
Before running this example, try setting the `MY_LOG_LEVEL` environment variable to `info`:
```no_run,shell
$ export MY_LOG_LEVEL='info'
```
Also try setting the `MY_LOG_STYLE` environment variable to `never` to disable colors
or `auto` to enable them:
```no_run,shell
$ export MY_LOG_STYLE=never
```
If you want to control the logging output completely, see the `custom_logger` example.
|
804 |
custom_format.rs |
!
Changing the default logging format.
Before running this example, try setting the `MY_LOG_LEVEL` environment variable to `info`:
```no_run,shell
$ export MY_LOG_LEVEL='info'
```
Also try setting the `MY_LOG_STYLE` environment variable to `never` to disable colors
or `auto` to enable them:
```no_run,shell
$ export MY_LOG_STYLE=never
```
If you want to control the logging output completely, see the `custom_logger` example.
|
1311 |
custom_logger.rs |
!
Using `env_logger` to drive a custom logger.
Before running this example, try setting the `MY_LOG_LEVEL` environment variable to `info`:
```no_run,shell
$ export MY_LOG_LEVEL='info'
```
If you only want to change the way logs are formatted, look at the `custom_format` example.
|
1318 |
default.rs |
!
Using `env_logger`.
Before running this example, try setting the `MY_LOG_LEVEL` environment variable to `info`:
```no_run,shell
$ export MY_LOG_LEVEL='info'
```
Also try setting the `MY_LOG_STYLE` environment variable to `never` to disable colors
or `auto` to enable them:
```no_run,shell
$ export MY_LOG_STYLE=never
```
|
856 |
direct_logger.rs |
!
Using `env_logger::Logger` and the `log::Log` trait directly.
This example doesn't rely on environment variables, or having a static logger installed.
|
993 |
filters_from_code.rs |
!
Specify logging filters in code instead of using an environment variable.
|
394 |
in_tests.rs |
!
Using `env_logger` in tests.
Log events will be captured by `cargo` and only printed if the test fails.
You can run this example by calling:
```text
cargo test --example in_tests
```
You should see the `it_does_not_work` test fail and include its log output.
|
1095 |
syslog_friendly_format.rs |
|
750 |