mirror of
https://github.com/facebook/sapling.git
synced 2024-12-25 05:53:24 +03:00
edenapi: optionally print log messages
Summary: Add log messages for debugging using the `tracing` crate, which allows them to be enabled via `env_logger`. Reviewed By: quark-zju Differential Revision: D23858076 fbshipit-source-id: a8ef1afac6c9ecbfb5d6d78232aa0d03a2fe2054
This commit is contained in:
parent
613fbc858f
commit
a745a145b1
@ -37,4 +37,5 @@ serde_json = "1.0"
|
|||||||
structopt = "0.3.7"
|
structopt = "0.3.7"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
tokio = { version = "=0.2.13", features = ["full"] }
|
tokio = { version = "=0.2.13", features = ["full"] }
|
||||||
|
tracing = "0.1"
|
||||||
url = "2.1.0"
|
url = "2.1.0"
|
||||||
|
@ -151,8 +151,12 @@ impl Client {
|
|||||||
impl EdenApi for Client {
|
impl EdenApi for Client {
|
||||||
async fn health(&self) -> Result<ResponseMeta, EdenApiError> {
|
async fn health(&self) -> Result<ResponseMeta, EdenApiError> {
|
||||||
let url = self.url(paths::HEALTH_CHECK, None)?;
|
let url = self.url(paths::HEALTH_CHECK, None)?;
|
||||||
|
|
||||||
|
tracing::info!("Sending health check request: {}", &url);
|
||||||
|
|
||||||
let req = self.configure(Request::get(url))?;
|
let req = self.configure(Request::get(url))?;
|
||||||
let res = req.send_async().await?;
|
let res = req.send_async().await?;
|
||||||
|
|
||||||
Ok(ResponseMeta::from(&res))
|
Ok(ResponseMeta::from(&res))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,6 +166,8 @@ impl EdenApi for Client {
|
|||||||
keys: Vec<Key>,
|
keys: Vec<Key>,
|
||||||
progress: Option<ProgressCallback>,
|
progress: Option<ProgressCallback>,
|
||||||
) -> Result<Fetch<FileEntry>, EdenApiError> {
|
) -> Result<Fetch<FileEntry>, EdenApiError> {
|
||||||
|
tracing::info!("Requesting content for {} files", keys.len());
|
||||||
|
|
||||||
if keys.is_empty() {
|
if keys.is_empty() {
|
||||||
return Err(EdenApiError::EmptyRequest);
|
return Err(EdenApiError::EmptyRequest);
|
||||||
}
|
}
|
||||||
@ -181,6 +187,8 @@ impl EdenApi for Client {
|
|||||||
length: Option<u32>,
|
length: Option<u32>,
|
||||||
progress: Option<ProgressCallback>,
|
progress: Option<ProgressCallback>,
|
||||||
) -> Result<Fetch<HistoryEntry>, EdenApiError> {
|
) -> Result<Fetch<HistoryEntry>, EdenApiError> {
|
||||||
|
tracing::info!("Requesting history for {} files", keys.len());
|
||||||
|
|
||||||
if keys.is_empty() {
|
if keys.is_empty() {
|
||||||
return Err(EdenApiError::EmptyRequest);
|
return Err(EdenApiError::EmptyRequest);
|
||||||
}
|
}
|
||||||
@ -217,6 +225,8 @@ impl EdenApi for Client {
|
|||||||
keys: Vec<Key>,
|
keys: Vec<Key>,
|
||||||
progress: Option<ProgressCallback>,
|
progress: Option<ProgressCallback>,
|
||||||
) -> Result<Fetch<TreeEntry>, EdenApiError> {
|
) -> Result<Fetch<TreeEntry>, EdenApiError> {
|
||||||
|
tracing::info!("Requesting content for {} files", keys.len());
|
||||||
|
|
||||||
if keys.is_empty() {
|
if keys.is_empty() {
|
||||||
return Err(EdenApiError::EmptyRequest);
|
return Err(EdenApiError::EmptyRequest);
|
||||||
}
|
}
|
||||||
@ -238,6 +248,12 @@ impl EdenApi for Client {
|
|||||||
depth: Option<usize>,
|
depth: Option<usize>,
|
||||||
progress: Option<ProgressCallback>,
|
progress: Option<ProgressCallback>,
|
||||||
) -> Result<Fetch<TreeEntry>, EdenApiError> {
|
) -> Result<Fetch<TreeEntry>, EdenApiError> {
|
||||||
|
tracing::info!(
|
||||||
|
"Requesting {} complete trees for directory {}",
|
||||||
|
mfnodes.len(),
|
||||||
|
&rootdir
|
||||||
|
);
|
||||||
|
|
||||||
let url = self.url(paths::COMPLETE_TREES, Some(&repo))?;
|
let url = self.url(paths::COMPLETE_TREES, Some(&repo))?;
|
||||||
let tree_req = CompleteTreeRequest {
|
let tree_req = CompleteTreeRequest {
|
||||||
rootdir,
|
rootdir,
|
||||||
@ -260,6 +276,8 @@ impl EdenApi for Client {
|
|||||||
hgids: Vec<HgId>,
|
hgids: Vec<HgId>,
|
||||||
progress: Option<ProgressCallback>,
|
progress: Option<ProgressCallback>,
|
||||||
) -> Result<Fetch<CommitRevlogData>, EdenApiError> {
|
) -> Result<Fetch<CommitRevlogData>, EdenApiError> {
|
||||||
|
tracing::info!("Requesting revlog data for {} commits", hgids.len());
|
||||||
|
|
||||||
let url = self.url(paths::COMMIT_REVLOG_DATA, Some(&repo))?;
|
let url = self.url(paths::COMMIT_REVLOG_DATA, Some(&repo))?;
|
||||||
let commit_revlog_data_req = CommitRevlogDataRequest { hgids };
|
let commit_revlog_data_req = CommitRevlogDataRequest { hgids };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user