Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 709b656

Browse filesBrowse files
committed
chore: make tracing-indicatif optional
1 parent 30e71fd commit 709b656
Copy full SHA for 709b656

File tree

Expand file treeCollapse file tree

7 files changed

+35
-15
lines changed
Filter options
Expand file treeCollapse file tree

7 files changed

+35
-15
lines changed

‎examples/download_progress_bar/Cargo.toml

Copy file name to clipboardExpand all lines: examples/download_progress_bar/Cargo.toml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version.workspace = true
88
[dependencies]
99
anyhow = { workspace = true }
1010
indicatif = { workspace = true }
11-
postgresql_embedded = { path = "../../postgresql_embedded" }
11+
postgresql_embedded = { path = "../../postgresql_embedded", features = ["indicatif"] }
1212
postgresql_extensions = { path = "../../postgresql_extensions" }
1313
tracing = { workspace = true }
1414
tracing-indicatif = { workspace = true }

‎postgresql_archive/Cargo.toml

Copy file name to clipboardExpand all lines: postgresql_archive/Cargo.toml
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ tempfile = { workspace = true }
3636
thiserror = { workspace = true }
3737
tokio = { workspace = true, features = ["full"], optional = true }
3838
tracing = { workspace = true, features = ["log"] }
39-
tracing-indicatif = { workspace = true }
39+
tracing-indicatif = { workspace = true, optional = true }
4040
url = { workspace = true }
4141
zip = { workspace = true }
4242

@@ -56,6 +56,9 @@ blocking = ["dep:tokio"]
5656
github = [
5757
"dep:serde_json",
5858
]
59+
indicatif = [
60+
"dep:tracing-indicatif"
61+
]
5962
maven = [
6063
"dep:quick-xml",
6164
"md5",

‎postgresql_archive/README.md

Copy file name to clipboardExpand all lines: postgresql_archive/README.md
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ uses.
4949

5050
The following features are available:
5151

52-
| Name | Description | Default? |
53-
|--------------|----------------------------|----------|
54-
| `blocking` | Enables the blocking API | No |
55-
| `native-tls` | Enables native-tls support | Yes |
56-
| `rustls-tls` | Enables rustls-tls support | No |
52+
| Name | Description | Default? |
53+
|--------------|----------------------------------|----------|
54+
| `blocking` | Enables the blocking API | No |
55+
| `indicatif` | Enables tracing-indcatif support | No |
56+
| `native-tls` | Enables native-tls support | Yes |
57+
| `rustls-tls` | Enables rustls-tls support | No |
5758

5859
### Configurations
5960

‎postgresql_archive/src/repository/github/repository.rs

Copy file name to clipboardExpand all lines: postgresql_archive/src/repository/github/repository.rs
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ use std::env;
2020
use std::io::Write;
2121
use std::str::FromStr;
2222
use std::sync::LazyLock;
23-
use tracing::{debug, instrument, warn, Span};
23+
use tracing::{debug, instrument, warn};
24+
#[cfg(feature = "indicatif")]
2425
use tracing_indicatif::span_ext::IndicatifSpanExt;
2526

2627
use url::Url;
@@ -225,13 +226,18 @@ impl Repository for GitHub {
225226
debug!("Downloading archive {}", asset.browser_download_url);
226227
let request = client.get(&asset.browser_download_url);
227228
let response = request.send().await?.error_for_status()?;
228-
let span = Span::current();
229-
let content_length = response.content_length().unwrap_or_default();
229+
#[cfg(feature = "indicatif")]
230+
let span = tracing::Span::current();
231+
#[cfg(feature = "indicatif")]
232+
{
233+
let content_length = response.content_length().unwrap_or_default();
234+
span.pb_set_length(content_length);
235+
}
230236
let mut bytes = Vec::new();
231237
let mut source = response.bytes_stream();
232-
span.pb_set_length(content_length);
233238
while let Some(chunk) = source.next().await {
234239
bytes.write_all(&chunk?)?;
240+
#[cfg(feature = "indicatif")]
235241
span.pb_set_position(bytes.len() as u64);
236242
}
237243
debug!(

‎postgresql_archive/src/repository/maven/repository.rs

Copy file name to clipboardExpand all lines: postgresql_archive/src/repository/maven/repository.rs
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ use semver::{Version, VersionReq};
1515
use std::env;
1616
use std::io::Write;
1717
use std::sync::LazyLock;
18-
use tracing::{debug, instrument, warn, Span};
18+
use tracing::{debug, instrument, warn};
19+
#[cfg(feature = "indicatif")]
1920
use tracing_indicatif::span_ext::IndicatifSpanExt;
2021

2122
static USER_AGENT: LazyLock<String> = LazyLock::new(|| {
@@ -132,13 +133,18 @@ impl Repository for Maven {
132133
debug!("Downloading archive {archive_url}");
133134
let request = client.get(&archive_url);
134135
let response = request.send().await?.error_for_status()?;
135-
let span = Span::current();
136-
let content_length = response.content_length().unwrap_or_default();
136+
#[cfg(feature = "indicatif")]
137+
let span = tracing::Span::current();
138+
#[cfg(feature = "indicatif")]
139+
{
140+
let content_length = response.content_length().unwrap_or_default();
141+
span.pb_set_length(content_length);
142+
}
137143
let mut bytes = Vec::new();
138144
let mut source = response.bytes_stream();
139-
span.pb_set_length(content_length);
140145
while let Some(chunk) = source.next().await {
141146
bytes.write_all(&chunk?)?;
147+
#[cfg(feature = "indicatif")]
142148
span.pb_set_position(bytes.len() as u64);
143149
}
144150
debug!("Archive {archive_url} downloaded: {}", bytes.len(),);

‎postgresql_embedded/Cargo.toml

Copy file name to clipboardExpand all lines: postgresql_embedded/Cargo.toml
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ default = [
4444
]
4545
blocking = ["tokio"]
4646
bundled = ["postgresql_archive/github"]
47+
indicatif = [
48+
"postgresql_archive/indicatif",
49+
]
4750
native-tls = [
4851
"postgresql_archive/native-tls",
4952
"sqlx/tls-native-tls",

‎postgresql_embedded/README.md

Copy file name to clipboardExpand all lines: postgresql_embedded/README.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ The following features are available:
103103
|--------------|----------------------------------------------------------|----------|
104104
| `bundled` | Bundles the PostgreSQL archive into the resulting binary | No |
105105
| `blocking` | Enables the blocking API; requires `tokio` | No |
106+
| `indicatif` | Enables tracing-indcatif support | No |
106107
| `native-tls` | Enables native-tls support | Yes |
107108
| `rustls-tls` | Enables rustls-tls support | No |
108109
| `theseus` | Enables theseus PostgreSQL binaries | Yes |

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.