Use tracing as log when tracing enabled

pull/34/head
Mingwei Samuel 2021-07-23 15:40:55 -07:00
parent 8dbcca434d
commit 00e520b7af
6 changed files with 37 additions and 14 deletions

View File

@ -1,7 +1,11 @@
use std::cmp;
use std::time::{ Duration, Instant };
#[cfg(not(feature="tracing"))]
use log;
#[cfg(feature="tracing")]
use tracing as log;
use parking_lot::{ RwLock, RwLockUpgradableReadGuard };
use reqwest::{ StatusCode, Response };
use scan_fmt::scan_fmt;

View File

@ -1,11 +1,15 @@
use std::future::Future;
use std::sync::Arc;
#[cfg(not(feature="tracing"))]
use log;
use reqwest::{ StatusCode, RequestBuilder };
#[cfg(feature="tracing")]
use tracing as log;
#[cfg(feature = "tracing")]
use tracing::Instrument;
use reqwest::{ StatusCode, RequestBuilder };
use crate::util::InsertOnlyCHashMap;
use crate::ResponseInfo;
use crate::Result;

View File

@ -1,7 +1,11 @@
use std::future::Future;
use std::sync::Arc;
#[cfg(not(feature="tracing"))]
use log;
#[cfg(feature="tracing")]
use tracing as log;
use reqwest::{ Client, RequestBuilder, Method };
use crate::Result;

12
test-full.bash Normal file
View File

@ -0,0 +1,12 @@
#!/bin/bash
set -ex
# Ensure stable builds.
cargo +stable test --no-run
cargo +stable test --no-run --features tracing
# Ensure nightly builds.
cargo +nightly test --no-run --features nightly,tracing
# Run tests on nightly.
RGAPI_KEY="$(cat apikey.txt)" RUST_BACKTRACE=1 RUST_LOG=riven=trace cargo +nightly test --features nightly -- --nocapture

View File

@ -1,5 +1,3 @@
#!/bin/bash
set -e
cargo +stable test --no-run
set -ex
RGAPI_KEY="$(cat apikey.txt)" RUST_BACKTRACE=1 RUST_LOG=riven=trace cargo +nightly test --features nightly -- --nocapture

View File

@ -49,16 +49,17 @@ async_tests!{
Ok(())
},
// tft-league-v1.getLeagueEntriesForSummoner
// https://github.com/MingweiSamuel/Riven/issues/25
tft_league_getleagueentriesforsummoner: async {
let sp = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "Caihonbbt");
let sr = sp.await.map_err(|e| e.to_string())?.ok_or("Failed to get \"Caihonbbt\"".to_owned())?;
let lp = RIOT_API.tft_league_v1().get_league_entries_for_summoner(ROUTE, &sr.id);
let lr = lp.await.map_err(|e| e.to_string())?;
rassert!(0 < lr.len());
Ok(())
},
// Disabled: Caihonbbt no longer ranked.
// // tft-league-v1.getLeagueEntriesForSummoner
// // https://github.com/MingweiSamuel/Riven/issues/25
// tft_league_getleagueentriesforsummoner: async {
// let sp = RIOT_API.summoner_v4().get_by_summoner_name(ROUTE, "Caihonbbt");
// let sr = sp.await.map_err(|e| e.to_string())?.ok_or("Failed to get \"Caihonbbt\"".to_owned())?;
// let lp = RIOT_API.tft_league_v1().get_league_entries_for_summoner(ROUTE, &sr.id);
// let lr = lp.await.map_err(|e| e.to_string())?;
// rassert!(0 < lr.len());
// Ok(())
// },
// tft-league-v1.getTopRatedLadder
// https://github.com/MingweiSamuel/Riven/issues/24
tft_league_gettopratedladder: async {