zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
49.53k stars 3.03k forks source link

`log` does not appear to work in extensions #17326

Open valentinegb opened 2 months ago

valentinegb commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Adding the log crate to an extension's Cargo.toml and using its macros appears to result in no output. Here's what I have in Cargo.toml, specifically:

[dependencies]
log = { version = "0.4.16", features = ["kv_unstable_serde", "serde"] }
zed_extension_api = "0.1.0"

In src/lib.rs I simply used log::debug!() in the Extension::language_server_command() declaration. I am running Zed with RUST_LOG=debug and I can see other debug messages.

Environment

Zed: v0.151.1 (Zed Preview) OS: macOS 15.1.0 Memory: 8 GiB Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

[Zed.log](https://github.com/user-attachments/files/16854307/Zed.log)
valentinegb commented 2 months ago

Having log is kind of a must, especially since Zed itself uses log. Using println!() instead (which does work) makes debugging messages difficult to find as opposed to debug!() and appears in Zed's output even if RUST_LOG were set to none.