rust-cli / rust-cli/env_logger

Hiding module path but displaying target

Open
#240 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi!

I'm currently stuck at configuring the logger. By default, if I write the following code:

// module: example
error!("YOH");
error!(target: "a", "YOH");

It will display:

[2022-10-19T11:08:47Z INFO  onix_server] YOH
[2022-10-19T11:08:47Z INFO  a] YOH

What I'd like to see is:

[2022-10-19T11:08:47Z INFO  ] YOH
[2022-10-19T11:08:47Z INFO  a] YOH

Which means not displaying the module the log comes from, but displaying the custom target if any is provided.

How can I achieve that? I use .format_module_path(false) but it seemed to have no effect.

Thanks in advance for your help!

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 by reviewing the format_module_path(false) configuration and the logger formatting behavior described in the issue. Confirm why disabling the module path has no effect, then verify that the module path is omitted while an explicitly provided target such as "a" remains visible.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
observability
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.