mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 17:08:13 +00:00
fix env logger
This commit is contained in:
1 parent
41334b1ee5
commit
58ec25e3aa
1 file changed
+12
-2
+12
-2
@@ -11,6 +11,8 @@ use std::path::{PathBuf, Path};
|
||||
use std::{fs, io, env};
|
||||
use std::str::FromStr;
|
||||
|
||||
const ENV_RUST_LOG : &'static str = "RUST_LOG";
|
||||
|
||||
struct BucketDownloader {
|
||||
bucket: Bucket,
|
||||
destination_directory: PathBuf,
|
||||
@@ -210,7 +212,14 @@ fn get_env(env_name: &str) -> AnyhowResult<String> {
|
||||
}
|
||||
|
||||
pub fn main() -> AnyhowResult<()> {
|
||||
std::env::set_var("RUST_LOG", "info");
|
||||
if env::var(ENV_RUST_LOG)
|
||||
.as_ref()
|
||||
.ok()
|
||||
.is_none()
|
||||
{
|
||||
std::env::set_var(ENV_RUST_LOG, "info");
|
||||
}
|
||||
|
||||
env_logger::init();
|
||||
|
||||
info!("starting");
|
||||
@@ -223,6 +232,7 @@ pub fn main() -> AnyhowResult<()> {
|
||||
let temp_dir = get_env(ENV_TEMP_DIR)?;
|
||||
let match_path = get_env(ENV_MATCH_PATH)?;
|
||||
|
||||
|
||||
let credentials = Credentials::new_blocking(
|
||||
Some(&access_key),
|
||||
Some(&secret_key),
|
||||
@@ -258,7 +268,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_base_directory() {
|
||||
let mut path = PathBuf::from("models/glow-tts-test/glow_tts_ljs_txlearn-2020.06.torchjit");
|
||||
let path = PathBuf::from("models/glow-tts-test/glow_tts_ljs_txlearn-2020.06.torchjit");
|
||||
assert_eq!(PathBuf::from("models/glow-tts-test"),
|
||||
BucketDownloader::base_directory(&path));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user