Skip to content

Convert remaining println!/eprintln! in examples and benches to arlog_*! #90

@kalwalt

Description

@kalwalt

Summary

Convert all remaining println! / eprintln! calls in crates/core/examples/ and crates/core/benches/ to the arlog_*! macros, per the project convention in CLAUDE.md §2 ("Logging — use the arlog system"). PR #85 already migrated simple.rs as the canonical model; finish the job across the rest.

Environment

Reproduction Steps

rg -c 'println!|eprintln!' crates/core/examples/ crates/core/benches/

Actual State (audit at HEAD of dev)

Examples — 152 total occurrences across 6 files:

File println! / eprintln! count
crates/core/examples/barcode.rs 11
crates/core/examples/debug_labeling.rs 4
crates/core/examples/generate_patt.rs 34
crates/core/examples/load_nft.rs 22 (mixes arlog_i! + println! — incomplete)
crates/core/examples/nft_marker_gen.rs 49
crates/core/examples/simple_nft.rs 32

Benches — 1 occurrence:

File Count
crates/core/benches/feature_map_bench.rs 1 (eprintln! for missing-asset skip)

Already converted (reference, not in scope):

Expected Behavior

Each file follows the simple.rs pattern:

  1. Replace println!("...") with arlog_i!("...") for informational output, arlog_e! for errors, arlog_d! for verbose/per-frame.
  2. Replace env_logger::init() (where present) with webarkitlib_rs::arlog::ar_log_init_default().
  3. Add use webarkitlib_rs::{arlog_e, arlog_i}; (or arlog_d / arlog_w as needed).
  4. Add required-features = ["log-helpers"] to the example's [[example]] block in crates/core/Cargo.toml if not already declared (so cargo run --example <name> works without a feature flag inside CI).
  5. Update .github/workflows/ci.yml if any of the converted examples are run there (currently only simple is invoked).

Visual Evidence

PR #85 diffs are the canonical model:

  • crates/core/examples/simple.rs — full conversion
  • crates/core/Cargo.tomlrequired-features = ["log-helpers"] for simple
  • .github/workflows/ci.yml--features log-helpers on the cargo run --example simple lines

Impact

Low (quality / consistency only) — does not change runtime behavior of the library. Aligns examples and benches with the convention library code already follows. Keeps newcomers from copying stale println! patterns into new code.

Suggested Approach (one PR per group recommended, NOT one giant PR)

To keep diffs reviewable:

  1. PR 1 — small examples: barcode.rs (11) + debug_labeling.rs (4) + the bench feature_map_bench.rs (1). Easy warm-up.
  2. PR 2 — load_nft.rs finish-up (22 remaining). The "canonical" example per CLAUDE.md still mixes println! with arlog_i!; finish converting it so it's actually canonical.
  3. PR 3 — generators: generate_patt.rs (34) + nft_marker_gen.rs (49). Heavier output volume; review separately.
  4. PR 4 — simple_nft.rs (32). Depends on ffi-backend feature — keep separate so reviewers with non-FFI setups can sign off on the others first.

Each PR:

  • Branch off latest dev, fresh per group.
  • Does not touch CHANGELOG.md.
  • Adds required-features = ["log-helpers"] for any example that doesn't have it yet.
  • Verifies cargo fmt --all -- --check, cargo clippy --all-targets --all-features, cargo build --all-features clean.

Additional Context

  • This is a quality-of-life / consistency cleanup, not a bug fix.
  • Logger-init prerequisite is already documented in crates/core/src/arlog.rs (rustdoc header refresh from the documentation skill, see feat: Port ARToolKit logging system (arLog / arLogv) to Rust — with efficiency analysis #57).
  • For the feature_map_bench.rs eprintln! → consider whether benches (which run under criterion) should use arlog_*! at all, or if eprintln! is acceptable in #[cfg(test)]-style scaffolding. Discussion welcome on the issue.

Labels suggested: chore, area:examples, area:benches, good-first-issue.
Priority: Low.

Metadata

Metadata

Assignees

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions