rust-cli / rust-cli/env_logger

I feel like I must be missing how `RUST_LOG` works OR that the documentation is wrong

Open
#207 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Rust
Stars
1.1k
Forks
149
Avg merge
2h 42m
Merged PRs (30d)
4

Description

One of the documentation examples for RUST_LOG says that

error,hello=off turn on global error logging, but turn off logging for hello

However, in my own app, I've tried setting it to RUST_LOG="debug,serenity=off" and my log keeps spewing things from serenity anyway:

[2021-06-12T14:40:26Z INFO  serenity::cache] update
[2021-06-12T14:40:26Z INFO  serenity::client::bridge::gateway::shard_runner] recv
[2021-06-12T14:40:26Z INFO  serenity::gateway::shard] check_heartbeat
[2021-06-12T14:40:26Z INFO  serenity::client::bridge::gateway::shard_runner] recv_event
[2021-06-12T14:40:27Z INFO  serenity::client::bridge::gateway::shard_runner] recv
[2021-06-12T14:40:27Z INFO  serenity::gateway::shard] check_heartbeat
[2021-06-12T14:40:27Z INFO  serenity::client::bridge::gateway::shard_runner] recv_event
...

Basically, the global debug seems to override everything, despite what the documentation says to the contrary.

If I do RUST_LOG="error,serenity=off", nothing prints though, so it's not like RUST_LOG isn't working at all. What's going on?

(What I originally wanted was to do RUST_LOG="debug,serenity::gateway::shard=warn,serenity::client::bridge::gateway::shard_runner=warn", but when that didn't work, I tried simplifying my value until I could find something that worked, and discovered that not even doing serenity=off worked.)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the env_logger 0.8.4 documentation example for RUST_LOG and reproduce the reported values debug,serenity=off and error,serenity=off. Trace how the directives are interpreted and determine whether the implementation or documentation explains the differing output; done means the behavior and expected configuration are made consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
observability-sre
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.