# Associate logs from log_err with the calling crate \(\#13617\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/97159bd88d6294128479cd1ee8b74de3fdad93d8)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 97159bd88d6294128479cd1ee8b74de3fdad93d8

Requested commit: 97159bd88d6294128479cd1ee8b74de3fdad93d8

Commit: 97159bd88d6294128479cd1ee8b74de3fdad93d8

Tree: 93110ce7aa4085125d340feaac528483a0f51666

Author: Max Brunsfeld

Committer: GitHub

## Message

```
Associate logs from log_err with the calling crate (#13617)

Now, when you selectively enable logs from particular crates with
`RUST_LOG=call,worktree`, logs created via `log_err` calls in those
crates get correctly enabled. Previously, they were all attributed to
the `util` crate, because they used the normal logging macros, which
implicitly insert the current crate name.

This relies on the regularity of our directory naming. Rust's
`track_caller` feature allows you to obtain the file system path of the
caller, but not its rust module path, so I'm inferring the crate name
from the file system path (which I believe is always valid, in our
codebase).

Release Notes:

- N/A
```

## Parents

- [0b57df5debe9866e2bb22c77217044df63b5e98b](https://git.cafe/gitcafe/zed/commit/0b57df5debe9866e2bb22c77217044df63b5e98b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/97159bd88d6294128479cd1ee8b74de3fdad93d8?format=markdown)
