Skip to content

Commit 96a2abd

Browse files
committed
fix: jsonl output includes newline
1 parent 15859c2 commit 96a2abd

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ STABLE_TOOLCHAIN := "1.87.0"
4444
# Run census.
4545
@run address port="8333":
4646
# Simply appending data to the file since each run is a "full" (not incremental) view of the world. A data point.
47-
cargo +{{STABLE_TOOLCHAIN}} run --release -- run --address {{address}} --port {{port}} --format json >> site/census.jsonl
47+
cargo +{{STABLE_TOOLCHAIN}} run --release -- run --address {{address}} --port {{port}} --format jsonl >> site/census.jsonl
4848
echo "Census result appended to site/census.jsonl"
4949

5050
# Publish a new version.

site/census.jsonl.backup

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{"timestamp": 1749923493, "duration_seconds": 92450, "stats": {"total_nodes": 11286, "v2_transport": 7007, "compact_filters": 1142, "v2_and_filters": 1023}, "census_version": "0.1.1"}
2+
{"timestamp":1750154015,"duration_seconds":92099,"total_contacted":365896,"stats":{"total_nodes":11249,"v2_transport":7101,"compact_filters":1178,"v2_and_filters":1061},"census_version":"0.1.2"}
3+
{"timestamp":1750228886,"duration_seconds":45640,"total_contacted":362684,"stats":{"total_nodes":11458,"v2_transport":7269,"compact_filters":1221,"v2_and_filters":1101},"census_version":"0.1.2"}

src/report.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl CensusReport {
5151
) -> Result<(), Box<dyn std::error::Error>> {
5252
let content = match format {
5353
OutputFormat::Json => serde_json::to_string_pretty(self)?,
54-
OutputFormat::Jsonl => serde_json::to_string(self)?,
54+
OutputFormat::Jsonl => format!("{}\n", serde_json::to_string(self)?),
5555
OutputFormat::Csv => self.format_csv()?,
5656
};
5757

0 commit comments

Comments
 (0)