Use env_logger instead of simplelog in tests

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2021-04-20 17:34:14 +02:00
parent 37444acc9c
commit ddd746b9f9
6 changed files with 6 additions and 10 deletions

2
Cargo.lock generated
View File

@ -993,6 +993,7 @@ dependencies = [
"core-graphics",
"core-text",
"ctor",
"env_logger",
"etagere",
"font-kit",
"foreign-types",
@ -2453,6 +2454,7 @@ dependencies = [
"ctor",
"dirs",
"easy-parallel",
"env_logger",
"fsevent",
"futures-core",
"gpui",

View File

@ -34,6 +34,7 @@ bindgen = "0.57"
cc = "1.0.67"
[dev-dependencies]
env_logger = "0.8"
png = "0.16"
simplelog = "0.9"

View File

@ -1,8 +1,6 @@
use ctor::ctor;
use simplelog::SimpleLogger;
use log::LevelFilter;
#[ctor]
fn init_logger() {
SimpleLogger::init(LevelFilter::Info, Default::default()).expect("could not initialize logger");
env_logger::init();
}

View File

@ -38,6 +38,7 @@ smallvec = "1.6.1"
smol = "1.2.5"
[dev-dependencies]
env_logger = "0.8"
serde_json = {version = "1.0.64", features = ["preserve_order"]}
tempdir = "0.3.7"
unindent = "0.1.7"

View File

@ -1,8 +1,6 @@
use crate::time::ReplicaId;
use ctor::ctor;
use log::LevelFilter;
use rand::Rng;
use simplelog::SimpleLogger;
use std::{
collections::BTreeMap,
path::{Path, PathBuf},
@ -11,7 +9,7 @@ use tempdir::TempDir;
#[ctor]
fn init_logger() {
SimpleLogger::init(LevelFilter::Info, Default::default()).expect("could not initialize logger");
env_logger::init();
}
#[derive(Clone)]

View File

@ -888,10 +888,8 @@ mod tests {
use crate::test::*;
use anyhow::Result;
use gpui::App;
use log::LevelFilter;
use rand::prelude::*;
use serde_json::json;
use simplelog::SimpleLogger;
use std::env;
use std::os::unix;
use std::time::{SystemTime, UNIX_EPOCH};
@ -1028,8 +1026,6 @@ mod tests {
.map(|o| o.parse().unwrap())
.unwrap_or(20);
let seeds = if let Ok(seed) = env::var("SEED").map(|s| s.parse().unwrap()) {
// Init logging so that we can debug the operations for this seed.
SimpleLogger::init(LevelFilter::Info, Default::default()).unwrap();
seed..seed + 1
} else {
0..iterations