zlog: Replace usages of env_logger in tests with zlog (#31436)

Also fixes:
https://github.com/zed-industries/zed/pull/31400#issuecomment-2908165249

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Ben Kunkle 2025-05-26 10:48:50 -05:00 committed by GitHub
parent 0c27aaecb3
commit c0aa8f63fd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 123 additions and 167 deletions

52
Cargo.lock generated
View file

@ -593,7 +593,6 @@ dependencies = [
"collections", "collections",
"context_server", "context_server",
"editor", "editor",
"env_logger 0.11.8",
"feature_flags", "feature_flags",
"fs", "fs",
"futures 0.3.31", "futures 0.3.31",
@ -619,6 +618,7 @@ dependencies = [
"workspace", "workspace",
"workspace-hack", "workspace-hack",
"worktree", "worktree",
"zlog",
] ]
[[package]] [[package]]
@ -631,7 +631,6 @@ dependencies = [
"collections", "collections",
"ctor", "ctor",
"derive_more", "derive_more",
"env_logger 0.11.8",
"futures 0.3.31", "futures 0.3.31",
"gpui", "gpui",
"icons", "icons",
@ -650,6 +649,7 @@ dependencies = [
"util", "util",
"workspace", "workspace",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -2222,7 +2222,6 @@ dependencies = [
"anyhow", "anyhow",
"clock", "clock",
"ctor", "ctor",
"env_logger 0.11.8",
"futures 0.3.31", "futures 0.3.31",
"git2", "git2",
"gpui", "gpui",
@ -2237,6 +2236,7 @@ dependencies = [
"unindent", "unindent",
"util", "util",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -3007,7 +3007,6 @@ dependencies = [
"debugger_ui", "debugger_ui",
"derive_more", "derive_more",
"editor", "editor",
"env_logger 0.11.8",
"envy", "envy",
"extension", "extension",
"file_finder", "file_finder",
@ -3082,6 +3081,7 @@ dependencies = [
"workspace-hack", "workspace-hack",
"worktree", "worktree",
"zed_llm_client", "zed_llm_client",
"zlog",
] ]
[[package]] [[package]]
@ -3336,7 +3336,6 @@ dependencies = [
"command_palette_hooks", "command_palette_hooks",
"ctor", "ctor",
"editor", "editor",
"env_logger 0.11.8",
"fs", "fs",
"futures 0.3.31", "futures 0.3.31",
"gpui", "gpui",
@ -3362,6 +3361,7 @@ dependencies = [
"util", "util",
"workspace", "workspace",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -4012,7 +4012,6 @@ dependencies = [
"client", "client",
"collections", "collections",
"dap-types", "dap-types",
"env_logger 0.11.8",
"fs", "fs",
"futures 0.3.31", "futures 0.3.31",
"gpui", "gpui",
@ -4033,6 +4032,7 @@ dependencies = [
"telemetry", "telemetry",
"util", "util",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -4219,7 +4219,6 @@ dependencies = [
"db", "db",
"debugger_tools", "debugger_tools",
"editor", "editor",
"env_logger 0.11.8",
"feature_flags", "feature_flags",
"file_icons", "file_icons",
"futures 0.3.31", "futures 0.3.31",
@ -4248,6 +4247,7 @@ dependencies = [
"util", "util",
"workspace", "workspace",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -4364,7 +4364,6 @@ dependencies = [
"component", "component",
"ctor", "ctor",
"editor", "editor",
"env_logger 0.11.8",
"futures 0.3.31", "futures 0.3.31",
"gpui", "gpui",
"indoc", "indoc",
@ -4385,6 +4384,7 @@ dependencies = [
"util", "util",
"workspace", "workspace",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -4683,7 +4683,6 @@ dependencies = [
"dap", "dap",
"db", "db",
"emojis", "emojis",
"env_logger 0.11.8",
"feature_flags", "feature_flags",
"file_icons", "file_icons",
"fs", "fs",
@ -4737,6 +4736,7 @@ dependencies = [
"workspace", "workspace",
"workspace-hack", "workspace-hack",
"zed_actions", "zed_actions",
"zlog",
] ]
[[package]] [[package]]
@ -5162,7 +5162,6 @@ dependencies = [
"criterion", "criterion",
"ctor", "ctor",
"dap", "dap",
"env_logger 0.11.8",
"extension", "extension",
"fs", "fs",
"futures 0.3.31", "futures 0.3.31",
@ -5199,6 +5198,7 @@ dependencies = [
"wasmtime", "wasmtime",
"wasmtime-wasi", "wasmtime-wasi",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -5372,7 +5372,6 @@ dependencies = [
"collections", "collections",
"ctor", "ctor",
"editor", "editor",
"env_logger 0.11.8",
"file_icons", "file_icons",
"futures 0.3.31", "futures 0.3.31",
"fuzzy", "fuzzy",
@ -5392,6 +5391,7 @@ dependencies = [
"util", "util",
"workspace", "workspace",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -6106,7 +6106,6 @@ dependencies = [
"ctor", "ctor",
"db", "db",
"editor", "editor",
"env_logger 0.11.8",
"futures 0.3.31", "futures 0.3.31",
"fuzzy", "fuzzy",
"git", "git",
@ -6142,6 +6141,7 @@ dependencies = [
"workspace", "workspace",
"workspace-hack", "workspace-hack",
"zed_actions", "zed_actions",
"zlog",
] ]
[[package]] [[package]]
@ -8723,7 +8723,6 @@ dependencies = [
"ctor", "ctor",
"diffy", "diffy",
"ec4rs", "ec4rs",
"env_logger 0.11.8",
"fs", "fs",
"futures 0.3.31", "futures 0.3.31",
"fuzzy", "fuzzy",
@ -8768,6 +8767,7 @@ dependencies = [
"unindent", "unindent",
"util", "util",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -8894,7 +8894,6 @@ dependencies = [
"collections", "collections",
"copilot", "copilot",
"editor", "editor",
"env_logger 0.11.8",
"futures 0.3.31", "futures 0.3.31",
"gpui", "gpui",
"itertools 0.14.0", "itertools 0.14.0",
@ -8911,6 +8910,7 @@ dependencies = [
"workspace", "workspace",
"workspace-hack", "workspace-hack",
"zed_actions", "zed_actions",
"zlog",
] ]
[[package]] [[package]]
@ -9433,7 +9433,6 @@ dependencies = [
"async-pipe", "async-pipe",
"collections", "collections",
"ctor", "ctor",
"env_logger 0.11.8",
"futures 0.3.31", "futures 0.3.31",
"gpui", "gpui",
"log", "log",
@ -9447,6 +9446,7 @@ dependencies = [
"smol", "smol",
"util", "util",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -9943,7 +9943,6 @@ dependencies = [
"clock", "clock",
"collections", "collections",
"ctor", "ctor",
"env_logger 0.11.8",
"gpui", "gpui",
"indoc", "indoc",
"itertools 0.14.0", "itertools 0.14.0",
@ -9964,6 +9963,7 @@ dependencies = [
"tree-sitter", "tree-sitter",
"util", "util",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -12030,7 +12030,6 @@ dependencies = [
"context_server", "context_server",
"dap", "dap",
"dap_adapters", "dap_adapters",
"env_logger 0.11.8",
"extension", "extension",
"fancy-regex 0.14.0", "fancy-regex 0.14.0",
"fs", "fs",
@ -13015,6 +13014,7 @@ dependencies = [
"unindent", "unindent",
"util", "util",
"worktree", "worktree",
"zlog",
] ]
[[package]] [[package]]
@ -13356,7 +13356,6 @@ dependencies = [
"arrayvec", "arrayvec",
"criterion", "criterion",
"ctor", "ctor",
"env_logger 0.11.8",
"gpui", "gpui",
"log", "log",
"rand 0.8.5", "rand 0.8.5",
@ -13366,6 +13365,7 @@ dependencies = [
"unicode-segmentation", "unicode-segmentation",
"util", "util",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -13383,7 +13383,6 @@ dependencies = [
"base64 0.22.1", "base64 0.22.1",
"chrono", "chrono",
"collections", "collections",
"env_logger 0.11.8",
"futures 0.3.31", "futures 0.3.31",
"gpui", "gpui",
"parking_lot", "parking_lot",
@ -13397,6 +13396,7 @@ dependencies = [
"tracing", "tracing",
"util", "util",
"workspace-hack", "workspace-hack",
"zlog",
"zstd", "zstd",
] ]
@ -14112,7 +14112,6 @@ dependencies = [
"client", "client",
"clock", "clock",
"collections", "collections",
"env_logger 0.11.8",
"feature_flags", "feature_flags",
"fs", "fs",
"futures 0.3.31", "futures 0.3.31",
@ -14143,6 +14142,7 @@ dependencies = [
"workspace", "workspace",
"workspace-hack", "workspace-hack",
"worktree", "worktree",
"zlog",
] ]
[[package]] [[package]]
@ -15175,11 +15175,11 @@ version = "0.1.0"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"ctor", "ctor",
"env_logger 0.11.8",
"log", "log",
"rand 0.8.5", "rand 0.8.5",
"rayon", "rayon",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -15490,7 +15490,6 @@ dependencies = [
"collections", "collections",
"ctor", "ctor",
"editor", "editor",
"env_logger 0.11.8",
"fuzzy", "fuzzy",
"gpui", "gpui",
"language", "language",
@ -15507,6 +15506,7 @@ dependencies = [
"util", "util",
"workspace", "workspace",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -15752,7 +15752,6 @@ dependencies = [
"clock", "clock",
"collections", "collections",
"ctor", "ctor",
"env_logger 0.11.8",
"gpui", "gpui",
"http_client", "http_client",
"log", "log",
@ -15765,6 +15764,7 @@ dependencies = [
"sum_tree", "sum_tree",
"util", "util",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -19113,7 +19113,6 @@ dependencies = [
"component", "component",
"dap", "dap",
"db", "db",
"env_logger 0.11.8",
"fs", "fs",
"futures 0.3.31", "futures 0.3.31",
"gpui", "gpui",
@ -19145,6 +19144,7 @@ dependencies = [
"windows 0.61.1", "windows 0.61.1",
"workspace-hack", "workspace-hack",
"zed_actions", "zed_actions",
"zlog",
] ]
[[package]] [[package]]
@ -19341,7 +19341,6 @@ dependencies = [
"anyhow", "anyhow",
"clock", "clock",
"collections", "collections",
"env_logger 0.11.8",
"fs", "fs",
"futures 0.3.31", "futures 0.3.31",
"fuzzy", "fuzzy",
@ -19368,6 +19367,7 @@ dependencies = [
"text", "text",
"util", "util",
"workspace-hack", "workspace-hack",
"zlog",
] ]
[[package]] [[package]]
@ -20061,7 +20061,6 @@ dependencies = [
"ctor", "ctor",
"db", "db",
"editor", "editor",
"env_logger 0.11.8",
"feature_flags", "feature_flags",
"fs", "fs",
"futures 0.3.31", "futures 0.3.31",
@ -20100,6 +20099,7 @@ dependencies = [
"worktree", "worktree",
"zed_actions", "zed_actions",
"zed_llm_client", "zed_llm_client",
"zlog",
] ]
[[package]] [[package]]

View file

@ -44,6 +44,6 @@ worktree.workspace = true
workspace-hack.workspace = true workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
env_logger.workspace = true
pretty_assertions.workspace = true pretty_assertions.workspace = true
settings.workspace = true settings.workspace = true
zlog.workspace = true

View file

@ -587,9 +587,7 @@ mod test {
use super::collect_files; use super::collect_files;
pub fn init_test(cx: &mut gpui::TestAppContext) { pub fn init_test(cx: &mut gpui::TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::try_init().ok();
}
cx.update(|cx| { cx.update(|cx| {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);

View file

@ -37,7 +37,6 @@ buffer_diff = { workspace = true, features = ["test-support"] }
collections = { workspace = true, features = ["test-support"] } collections = { workspace = true, features = ["test-support"] }
clock = { workspace = true, features = ["test-support"] } clock = { workspace = true, features = ["test-support"] }
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
language = { workspace = true, features = ["test-support"] } language = { workspace = true, features = ["test-support"] }
language_model = { workspace = true, features = ["test-support"] } language_model = { workspace = true, features = ["test-support"] }
@ -48,3 +47,4 @@ rand.workspace = true
settings = { workspace = true, features = ["test-support"] } settings = { workspace = true, features = ["test-support"] }
text = { workspace = true, features = ["test-support"] } text = { workspace = true, features = ["test-support"] }
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -717,9 +717,7 @@ mod tests {
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
fn init_test(cx: &mut TestAppContext) { fn init_test(cx: &mut TestAppContext) {

View file

@ -676,9 +676,7 @@ mod tests {
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
fn init_test(cx: &mut TestAppContext) { fn init_test(cx: &mut TestAppContext) {

View file

@ -673,8 +673,7 @@ mod tests {
use super::*; use super::*;
fn init_test(executor: &BackgroundExecutor, cx: &mut TestAppContext) { fn init_test(executor: &BackgroundExecutor, cx: &mut TestAppContext) {
zlog::init(); zlog::init_test();
zlog::init_output_stdout();
executor.allow_parking(); executor.allow_parking();
cx.update(|cx| { cx.update(|cx| {

View file

@ -31,9 +31,9 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
rand.workspace = true rand.workspace = true
serde_json.workspace = true serde_json.workspace = true
text = { workspace = true, features = ["test-support"] } text = { workspace = true, features = ["test-support"] }
unindent.workspace = true unindent.workspace = true
zlog.workspace = true

View file

@ -1346,9 +1346,7 @@ mod tests {
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[gpui::test] #[gpui::test]

View file

@ -95,7 +95,6 @@ dap = { workspace = true, features = ["test-support"] }
dap_adapters = { workspace = true, features = ["test-support"] } dap_adapters = { workspace = true, features = ["test-support"] }
debugger_ui = { workspace = true, features = ["test-support"] } debugger_ui = { workspace = true, features = ["test-support"] }
editor = { workspace = true, features = ["test-support"] } editor = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
extension.workspace = true extension.workspace = true
file_finder.workspace = true file_finder.workspace = true
fs = { workspace = true, features = ["test-support"] } fs = { workspace = true, features = ["test-support"] }
@ -133,6 +132,7 @@ unindent.workspace = true
util.workspace = true util.workspace = true
workspace = { workspace = true, features = ["test-support"] } workspace = { workspace = true, features = ["test-support"] }
worktree = { workspace = true, features = ["test-support"] } worktree = { workspace = true, features = ["test-support"] }
zlog.workspace = true
[package.metadata.cargo-machete] [package.metadata.cargo-machete]
ignored = ["async-stripe"] ignored = ["async-stripe"]

View file

@ -18,9 +18,7 @@ use workspace::{Workspace, dock::Panel};
use super::{TestClient, TestServer}; use super::{TestClient, TestServer};
pub fn init_test(cx: &mut gpui::TestAppContext) { pub fn init_test(cx: &mut gpui::TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::try_init().ok();
}
cx.update(|cx| { cx.update(|cx| {
theme::init(theme::LoadThemes::JustBase, cx); theme::init(theme::LoadThemes::JustBase, cx);

View file

@ -56,9 +56,7 @@ use workspace::Pane;
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[gpui::test(iterations = 10)] #[gpui::test(iterations = 10)]

View file

@ -589,9 +589,7 @@ async fn test_remote_server_debugger(
cx_a.update(|cx| { cx_a.update(|cx| {
release_channel::init(SemanticVersion::default(), cx); release_channel::init(SemanticVersion::default(), cx);
command_palette_hooks::init(cx); command_palette_hooks::init(cx);
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::try_init().ok();
}
dap_adapters::init(cx); dap_adapters::init(cx);
}); });
server_cx.update(|cx| { server_cx.update(|cx| {

View file

@ -61,7 +61,6 @@ clock = { workspace = true, features = ["test-support"] }
collections = { workspace = true, features = ["test-support"] } collections = { workspace = true, features = ["test-support"] }
ctor.workspace = true ctor.workspace = true
editor = { workspace = true, features = ["test-support"] } editor = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
fs = { workspace = true, features = ["test-support"] } fs = { workspace = true, features = ["test-support"] }
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
http_client = { workspace = true, features = ["test-support"] } http_client = { workspace = true, features = ["test-support"] }
@ -76,3 +75,4 @@ settings = { workspace = true, features = ["test-support"] }
theme = { workspace = true, features = ["test-support"] } theme = { workspace = true, features = ["test-support"] }
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
workspace = { workspace = true, features = ["test-support"] } workspace = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -1329,7 +1329,5 @@ mod tests {
#[cfg(test)] #[cfg(test)]
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }

View file

@ -53,8 +53,8 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
async-pipe.workspace = true async-pipe.workspace = true
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
settings = { workspace = true, features = ["test-support"] } settings = { workspace = true, features = ["test-support"] }
task = { workspace = true, features = ["test-support"] } task = { workspace = true, features = ["test-support"] }
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -281,9 +281,7 @@ mod tests {
}; };
pub fn init_test(cx: &mut gpui::TestAppContext) { pub fn init_test(cx: &mut gpui::TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::try_init().ok();
}
cx.update(|cx| { cx.update(|cx| {
let settings = SettingsStore::test(cx); let settings = SettingsStore::test(cx);

View file

@ -21,7 +21,6 @@ test-support = [
"project/test-support", "project/test-support",
"util/test-support", "util/test-support",
"workspace/test-support", "workspace/test-support",
"env_logger",
"unindent", "unindent",
"debugger_tools" "debugger_tools"
] ]
@ -62,7 +61,6 @@ ui.workspace = true
util.workspace = true util.workspace = true
workspace.workspace = true workspace.workspace = true
workspace-hack.workspace = true workspace-hack.workspace = true
env_logger = { workspace = true, optional = true }
debugger_tools = { workspace = true, optional = true } debugger_tools = { workspace = true, optional = true }
unindent = { workspace = true, optional = true } unindent = { workspace = true, optional = true }
@ -71,9 +69,9 @@ dap = { workspace = true, features = ["test-support"] }
dap_adapters = { workspace = true, features = ["test-support"] } dap_adapters = { workspace = true, features = ["test-support"] }
debugger_tools = { workspace = true, features = ["test-support"] } debugger_tools = { workspace = true, features = ["test-support"] }
editor = { workspace = true, features = ["test-support"] } editor = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
project = { workspace = true, features = ["test-support"] } project = { workspace = true, features = ["test-support"] }
unindent.workspace = true unindent.workspace = true
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
workspace = { workspace = true, features = ["test-support"] } workspace = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -35,9 +35,8 @@ mod stack_frame_list;
mod variable_list; mod variable_list;
pub fn init_test(cx: &mut gpui::TestAppContext) { pub fn init_test(cx: &mut gpui::TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { #[cfg(test)]
env_logger::try_init().ok(); zlog::init_test();
}
cx.update(|cx| { cx.update(|cx| {
let settings = SettingsStore::test(cx); let settings = SettingsStore::test(cx);

View file

@ -18,7 +18,6 @@ collections.workspace = true
component.workspace = true component.workspace = true
ctor.workspace = true ctor.workspace = true
editor.workspace = true editor.workspace = true
env_logger.workspace = true
futures.workspace = true futures.workspace = true
gpui.workspace = true gpui.workspace = true
indoc.workspace = true indoc.workspace = true
@ -44,9 +43,10 @@ editor = { workspace = true, features = ["test-support"] }
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
language = { workspace = true, features = ["test-support"] } language = { workspace = true, features = ["test-support"] }
markdown = { workspace = true, features = ["test-support"] } markdown = { workspace = true, features = ["test-support"] }
lsp = { workspace = true, features = ["test-support"] } lsp = { workspace = true, features=["test-support"] }
serde_json.workspace = true serde_json.workspace = true
theme = { workspace = true, features = ["test-support"] } theme = { workspace = true, features = ["test-support"] }
unindent.workspace = true unindent.workspace = true
workspace = { workspace = true, features = ["test-support"] } workspace = { workspace = true, features = ["test-support"] }
pretty_assertions.workspace = true pretty_assertions.workspace = true
zlog.workspace = true

View file

@ -27,9 +27,7 @@ use util::{RandomCharIter, path, post_inc};
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[gpui::test] #[gpui::test]
@ -1413,7 +1411,7 @@ async fn test_diagnostics_with_code(cx: &mut TestAppContext) {
fn init_test(cx: &mut TestAppContext) { fn init_test(cx: &mut TestAppContext) {
cx.update(|cx| { cx.update(|cx| {
env_logger::try_init().ok(); zlog::init_test();
let settings = SettingsStore::test(cx); let settings = SettingsStore::test(cx);
cx.set_global(settings); cx.set_global(settings);
theme::init(theme::LoadThemes::JustBase, cx); theme::init(theme::LoadThemes::JustBase, cx);

View file

@ -93,7 +93,6 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
language = { workspace = true, features = ["test-support"] } language = { workspace = true, features = ["test-support"] }
languages = {workspace = true, features = ["test-support"] } languages = {workspace = true, features = ["test-support"] }
@ -113,3 +112,4 @@ unindent.workspace = true
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
workspace = { workspace = true, features = ["test-support"] } workspace = { workspace = true, features = ["test-support"] }
http_client = { workspace = true, features = ["test-support"] } http_client = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -25,9 +25,7 @@ use util::test::{marked_text_offsets, marked_text_ranges};
#[cfg(test)] #[cfg(test)]
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
pub fn test_font() -> Font { pub fn test_font() -> Font {

View file

@ -57,7 +57,6 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
criterion.workspace = true criterion.workspace = true
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true
fs = { workspace = true, features = ["test-support"] } fs = { workspace = true, features = ["test-support"] }
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
language = { workspace = true, features = ["test-support"] } language = { workspace = true, features = ["test-support"] }
@ -68,6 +67,7 @@ rand.workspace = true
reqwest_client.workspace = true reqwest_client.workspace = true
theme = { workspace = true, features = ["test-support"] } theme = { workspace = true, features = ["test-support"] }
theme_extension.workspace = true theme_extension.workspace = true
zlog.workspace = true
[[bench]] [[bench]]
name = "extension_compilation_benchmark" name = "extension_compilation_benchmark"

View file

@ -30,9 +30,7 @@ use util::test::TempTree;
#[cfg(test)] #[cfg(test)]
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[gpui::test] #[gpui::test]

View file

@ -37,10 +37,10 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
ctor.workspace = true ctor.workspace = true
editor = { workspace = true, features = ["test-support"] } editor = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
language = { workspace = true, features = ["test-support"] } language = { workspace = true, features = ["test-support"] }
picker = { workspace = true, features = ["test-support"] } picker = { workspace = true, features = ["test-support"] }
serde_json.workspace = true serde_json.workspace = true
theme = { workspace = true, features = ["test-support"] } theme = { workspace = true, features = ["test-support"] }
workspace = { workspace = true, features = ["test-support"] } workspace = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -11,9 +11,7 @@ use workspace::{AppState, OpenOptions, ToggleFileFinder, Workspace};
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[test] #[test]

View file

@ -65,7 +65,6 @@ windows.workspace = true
[dev-dependencies] [dev-dependencies]
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true
editor = { workspace = true, features = ["test-support"] } editor = { workspace = true, features = ["test-support"] }
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
pretty_assertions.workspace = true pretty_assertions.workspace = true
@ -73,3 +72,4 @@ project = { workspace = true, features = ["test-support"] }
settings = { workspace = true, features = ["test-support"] } settings = { workspace = true, features = ["test-support"] }
unindent.workspace = true unindent.workspace = true
workspace = { workspace = true, features = ["test-support"] } workspace = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -4779,9 +4779,7 @@ mod tests {
use super::*; use super::*;
fn init_test(cx: &mut gpui::TestAppContext) { fn init_test(cx: &mut gpui::TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::try_init().ok();
}
cx.update(|cx| { cx.update(|cx| {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);

View file

@ -1347,7 +1347,7 @@ mod tests {
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
env_logger::init(); zlog::init_test();
} }
fn init_test(cx: &mut TestAppContext) { fn init_test(cx: &mut TestAppContext) {

View file

@ -71,7 +71,6 @@ diffy = "0.4.2"
[dev-dependencies] [dev-dependencies]
collections = { workspace = true, features = ["test-support"] } collections = { workspace = true, features = ["test-support"] }
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
indoc.workspace = true indoc.workspace = true
lsp = { workspace = true, features = ["test-support"] } lsp = { workspace = true, features = ["test-support"] }
@ -92,3 +91,4 @@ tree-sitter-rust.workspace = true
tree-sitter-typescript.workspace = true tree-sitter-typescript.workspace = true
unindent.workspace = true unindent.workspace = true
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -39,9 +39,7 @@ pub static TRAILING_WHITESPACE_REGEX: LazyLock<regex::Regex> = LazyLock::new(||
#[cfg(test)] #[cfg(test)]
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[gpui::test] #[gpui::test]

View file

@ -36,6 +36,6 @@ workspace-hack.workspace = true
client = { workspace = true, features = ["test-support"] } client = { workspace = true, features = ["test-support"] }
editor = { workspace = true, features = ["test-support"] } editor = { workspace = true, features = ["test-support"] }
release_channel.workspace = true release_channel.workspace = true
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -15,9 +15,7 @@ use util::path;
#[gpui::test] #[gpui::test]
async fn test_lsp_logs(cx: &mut TestAppContext) { async fn test_lsp_logs(cx: &mut TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
init_test(cx); init_test(cx);

View file

@ -36,6 +36,6 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
async-pipe.workspace = true async-pipe.workspace = true
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -1668,9 +1668,7 @@ mod tests {
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[gpui::test] #[gpui::test]

View file

@ -27,7 +27,6 @@ clock.workspace = true
collections.workspace = true collections.workspace = true
ctor.workspace = true ctor.workspace = true
buffer_diff.workspace = true buffer_diff.workspace = true
env_logger.workspace = true
gpui.workspace = true gpui.workspace = true
itertools.workspace = true itertools.workspace = true
language.workspace = true language.workspace = true
@ -57,3 +56,4 @@ rand.workspace = true
settings = { workspace = true, features = ["test-support"] } settings = { workspace = true, features = ["test-support"] }
text = { workspace = true, features = ["test-support"] } text = { workspace = true, features = ["test-support"] }
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -11,9 +11,7 @@ use util::test::sample_text;
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[gpui::test] #[gpui::test]

View file

@ -93,7 +93,6 @@ collections = { workspace = true, features = ["test-support"] }
buffer_diff = { workspace = true, features = ["test-support"] } buffer_diff = { workspace = true, features = ["test-support"] }
dap = { workspace = true, features = ["test-support"] } dap = { workspace = true, features = ["test-support"] }
dap_adapters = { workspace = true, features = ["test-support"] } dap_adapters = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
fs = { workspace = true, features = ["test-support"] } fs = { workspace = true, features = ["test-support"] }
git2.workspace = true git2.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }

View file

@ -463,7 +463,7 @@ mod tests {
#[gpui::test] #[gpui::test]
async fn test_conflict_updates(executor: BackgroundExecutor, cx: &mut TestAppContext) { async fn test_conflict_updates(executor: BackgroundExecutor, cx: &mut TestAppContext) {
env_logger::try_init().ok(); zlog::init_test();
cx.update(|cx| { cx.update(|cx| {
settings::init(cx); settings::init(cx);
WorktreeSettings::register(cx); WorktreeSettings::register(cx);

View file

@ -674,9 +674,7 @@ mod tests {
} }
fn init_test(cx: &mut gpui::TestAppContext) { fn init_test(cx: &mut gpui::TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::try_init().ok();
}
cx.update(|cx| { cx.update(|cx| {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);

View file

@ -739,9 +739,7 @@ mod tests {
use std::path::PathBuf; use std::path::PathBuf;
pub fn init_test(cx: &mut TestAppContext) { pub fn init_test(cx: &mut TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::try_init().ok();
}
cx.update(|cx| { cx.update(|cx| {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);

View file

@ -8528,9 +8528,7 @@ async fn search(
} }
pub fn init_test(cx: &mut gpui::TestAppContext) { pub fn init_test(cx: &mut gpui::TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::try_init().ok();
}
cx.update(|cx| { cx.update(|cx| {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);

View file

@ -1191,9 +1191,7 @@ mod tests {
} }
fn init_test(_cx: &mut TestAppContext) { fn init_test(_cx: &mut TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::try_init().ok();
}
TaskStore::init(None); TaskStore::init(None);
} }

View file

@ -86,6 +86,7 @@ language_model = { workspace = true, features = ["test-support"] }
lsp = { workspace = true, features=["test-support"] } lsp = { workspace = true, features=["test-support"] }
unindent.workspace = true unindent.workspace = true
serde_json.workspace = true serde_json.workspace = true
zlog.workspace = true
[build-dependencies] [build-dependencies]
cargo_toml.workspace = true cargo_toml.workspace = true

View file

@ -1663,9 +1663,7 @@ pub async fn init_test(
} }
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::try_init().ok();
}
} }
fn build_project(ssh: Entity<SshRemoteClient>, cx: &mut TestAppContext) -> Entity<Project> { fn build_project(ssh: Entity<SshRemoteClient>, cx: &mut TestAppContext) -> Entity<Project> {

View file

@ -23,11 +23,11 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
rand.workspace = true rand.workspace = true
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
criterion.workspace = true criterion.workspace = true
zlog.workspace = true
[[bench]] [[bench]]
name = "rope_benchmark" name = "rope_benchmark"

View file

@ -1435,9 +1435,7 @@ mod tests {
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[test] #[test]

View file

@ -40,6 +40,6 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
collections = { workspace = true, features = ["test-support"] } collections = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
proto = { workspace = true, features = ["test-support"] } proto = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -684,9 +684,7 @@ mod tests {
use gpui::TestAppContext; use gpui::TestAppContext;
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[gpui::test(iterations = 50)] #[gpui::test(iterations = 50)]

View file

@ -54,7 +54,6 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
client = { workspace = true, features = ["test-support"] } client = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
fs = { workspace = true, features = ["test-support"] } fs = { workspace = true, features = ["test-support"] }
futures.workspace = true futures.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
@ -67,3 +66,4 @@ reqwest_client.workspace = true
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
workspace = { workspace = true, features = ["test-support"] } workspace = { workspace = true, features = ["test-support"] }
worktree = { workspace = true, features = ["test-support"] } worktree = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -12,7 +12,7 @@ use std::{
}; };
fn main() { fn main() {
env_logger::init(); zlog::init();
use clock::FakeSystemClock; use clock::FakeSystemClock;

View file

@ -280,7 +280,7 @@ mod tests {
use util::separator; use util::separator;
fn init_test(cx: &mut TestAppContext) { fn init_test(cx: &mut TestAppContext) {
env_logger::try_init().ok(); zlog::init_test();
cx.update(|cx| { cx.update(|cx| {
let store = SettingsStore::test(cx); let store = SettingsStore::test(cx);

View file

@ -20,5 +20,5 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true
rand.workspace = true rand.workspace = true
zlog.workspace = true

View file

@ -998,9 +998,7 @@ mod tests {
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[test] #[test]

View file

@ -32,9 +32,9 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
anyhow.workspace = true anyhow.workspace = true
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
language = { workspace = true, features = ["test-support"] } language = { workspace = true, features = ["test-support"] }
serde_json.workspace = true serde_json.workspace = true
theme = { workspace = true, features = ["test-support"] } theme = { workspace = true, features = ["test-support"] }
workspace = { workspace = true, features = ["test-support"] } workspace = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -10,9 +10,7 @@ use workspace::{AppState, Workspace};
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[gpui::test] #[gpui::test]

View file

@ -33,8 +33,8 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
collections = { workspace = true, features = ["test-support"] } collections = { workspace = true, features = ["test-support"] }
ctor.workspace = true ctor.workspace = true
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
rand.workspace = true rand.workspace = true
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
http_client = { workspace = true, features = ["test-support"] } http_client = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -11,9 +11,7 @@ use std::{
#[cfg(test)] #[cfg(test)]
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
#[test] #[test]

View file

@ -74,7 +74,6 @@ call = { workspace = true, features = ["test-support"] }
client = { workspace = true, features = ["test-support"] } client = { workspace = true, features = ["test-support"] }
dap = { workspace = true, features = ["test-support"] } dap = { workspace = true, features = ["test-support"] }
db = { workspace = true, features = ["test-support"] } db = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
fs = { workspace = true, features = ["test-support"] } fs = { workspace = true, features = ["test-support"] }
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
project = { workspace = true, features = ["test-support"] } project = { workspace = true, features = ["test-support"] }
@ -82,3 +81,4 @@ session = { workspace = true, features = ["test-support"] }
settings = { workspace = true, features = ["test-support"] } settings = { workspace = true, features = ["test-support"] }
http_client = { workspace = true, features = ["test-support"] } http_client = { workspace = true, features = ["test-support"] }
tempfile.workspace = true tempfile.workspace = true
zlog.workspace = true

View file

@ -1466,7 +1466,7 @@ mod tests {
#[gpui::test] #[gpui::test]
async fn test_breakpoints() { async fn test_breakpoints() {
env_logger::try_init().ok(); zlog::init_test();
let db = WorkspaceDb::open_test_db("test_breakpoints").await; let db = WorkspaceDb::open_test_db("test_breakpoints").await;
let id = db.next_id().await.unwrap(); let id = db.next_id().await.unwrap();
@ -1651,7 +1651,7 @@ mod tests {
#[gpui::test] #[gpui::test]
async fn test_remove_last_breakpoint() { async fn test_remove_last_breakpoint() {
env_logger::try_init().ok(); zlog::init_test();
let db = WorkspaceDb::open_test_db("test_remove_last_breakpoint").await; let db = WorkspaceDb::open_test_db("test_remove_last_breakpoint").await;
let id = db.next_id().await.unwrap(); let id = db.next_id().await.unwrap();
@ -1738,7 +1738,7 @@ mod tests {
#[gpui::test] #[gpui::test]
async fn test_next_id_stability() { async fn test_next_id_stability() {
env_logger::try_init().ok(); zlog::init_test();
let db = WorkspaceDb::open_test_db("test_next_id_stability").await; let db = WorkspaceDb::open_test_db("test_next_id_stability").await;
@ -1786,7 +1786,7 @@ mod tests {
#[gpui::test] #[gpui::test]
async fn test_workspace_id_stability() { async fn test_workspace_id_stability() {
env_logger::try_init().ok(); zlog::init_test();
let db = WorkspaceDb::open_test_db("test_workspace_id_stability").await; let db = WorkspaceDb::open_test_db("test_workspace_id_stability").await;
@ -1880,7 +1880,7 @@ mod tests {
#[gpui::test] #[gpui::test]
async fn test_full_workspace_serialization() { async fn test_full_workspace_serialization() {
env_logger::try_init().ok(); zlog::init_test();
let db = WorkspaceDb::open_test_db("test_full_workspace_serialization").await; let db = WorkspaceDb::open_test_db("test_full_workspace_serialization").await;
@ -1955,7 +1955,7 @@ mod tests {
#[gpui::test] #[gpui::test]
async fn test_workspace_assignment() { async fn test_workspace_assignment() {
env_logger::try_init().ok(); zlog::init_test();
let db = WorkspaceDb::open_test_db("test_basic_functionality").await; let db = WorkspaceDb::open_test_db("test_basic_functionality").await;
@ -2051,7 +2051,7 @@ mod tests {
#[gpui::test] #[gpui::test]
async fn test_session_workspaces() { async fn test_session_workspaces() {
env_logger::try_init().ok(); zlog::init_test();
let db = WorkspaceDb::open_test_db("test_serializing_workspaces_session_id").await; let db = WorkspaceDb::open_test_db("test_serializing_workspaces_session_id").await;
@ -2488,7 +2488,7 @@ mod tests {
#[gpui::test] #[gpui::test]
async fn test_simple_split() { async fn test_simple_split() {
env_logger::try_init().ok(); zlog::init_test();
let db = WorkspaceDb::open_test_db("simple_split").await; let db = WorkspaceDb::open_test_db("simple_split").await;
@ -2543,7 +2543,7 @@ mod tests {
#[gpui::test] #[gpui::test]
async fn test_cleanup_panes() { async fn test_cleanup_panes() {
env_logger::try_init().ok(); zlog::init_test();
let db = WorkspaceDb::open_test_db("test_cleanup_panes").await; let db = WorkspaceDb::open_test_db("test_cleanup_panes").await;

View file

@ -52,7 +52,6 @@ workspace-hack.workspace = true
[dev-dependencies] [dev-dependencies]
clock = { workspace = true, features = ["test-support"] } clock = { workspace = true, features = ["test-support"] }
collections = { workspace = true, features = ["test-support"] } collections = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
git2.workspace = true git2.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
http_client.workspace = true http_client.workspace = true
@ -61,3 +60,4 @@ rand.workspace = true
rpc = { workspace = true, features = ["test-support"] } rpc = { workspace = true, features = ["test-support"] }
settings = { workspace = true, features = ["test-support"] } settings = { workspace = true, features = ["test-support"] }
util = { workspace = true, features = ["test-support"] } util = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -2091,9 +2091,7 @@ fn check_worktree_entries(
} }
fn init_test(cx: &mut gpui::TestAppContext) { fn init_test(cx: &mut gpui::TestAppContext) {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::try_init().ok();
}
cx.update(|cx| { cx.update(|cx| {
let settings_store = SettingsStore::test(cx); let settings_store = SettingsStore::test(cx);

View file

@ -64,7 +64,6 @@ client = { workspace = true, features = ["test-support"] }
clock = { workspace = true, features = ["test-support"] } clock = { workspace = true, features = ["test-support"] }
ctor.workspace = true ctor.workspace = true
editor = { workspace = true, features = ["test-support"] } editor = { workspace = true, features = ["test-support"] }
env_logger.workspace = true
gpui = { workspace = true, features = ["test-support"] } gpui = { workspace = true, features = ["test-support"] }
http_client = { workspace = true, features = ["test-support"] } http_client = { workspace = true, features = ["test-support"] }
indoc.workspace = true indoc.workspace = true
@ -79,3 +78,4 @@ unindent.workspace = true
workspace = { workspace = true, features = ["test-support"] } workspace = { workspace = true, features = ["test-support"] }
worktree = { workspace = true, features = ["test-support"] } worktree = { workspace = true, features = ["test-support"] }
call = { workspace = true, features = ["test-support"] } call = { workspace = true, features = ["test-support"] }
zlog.workspace = true

View file

@ -2140,8 +2140,6 @@ mod tests {
#[ctor::ctor] #[ctor::ctor]
fn init_logger() { fn init_logger() {
if std::env::var("RUST_LOG").is_ok() { zlog::init_test();
env_logger::init();
}
} }
} }

View file

@ -5,18 +5,38 @@ mod env_config;
pub mod filter; pub mod filter;
pub mod sink; pub mod sink;
use anyhow::Context;
pub use sink::{flush, init_output_file, init_output_stdout}; pub use sink::{flush, init_output_file, init_output_stdout};
pub const SCOPE_DEPTH_MAX: usize = 4; pub const SCOPE_DEPTH_MAX: usize = 4;
pub fn init() { pub fn init() {
process_env(); try_init().expect("Failed to initialize logger");
log::set_logger(&ZLOG).expect("Logger should not be initialized twice"); }
pub fn try_init() -> anyhow::Result<()> {
log::set_logger(&ZLOG).context("cannot be initialized twice")?;
log::set_max_level(log::LevelFilter::max()); log::set_max_level(log::LevelFilter::max());
process_env();
Ok(())
}
pub fn init_test() {
if get_env_config().is_some() {
if try_init().is_ok() {
init_output_stdout();
}
}
}
fn get_env_config() -> Option<String> {
std::env::var("ZED_LOG")
.or_else(|_| std::env::var("RUST_LOG"))
.ok()
} }
pub fn process_env() { pub fn process_env() {
let Ok(env_config) = std::env::var("ZED_LOG").or_else(|_| std::env::var("RUST_LOG")) else { let Some(env_config) = get_env_config() else {
return; return;
}; };
match env_config::parse(&env_config) { match env_config::parse(&env_config) {