Skip to content

Add structured logging event StructuredLogEntry to events.rs with stable schema id #651

Description

@greatest0fallt1me

Description

events.rs emits many domain events but observability tooling has no stable, machine-parseable schema. Introduce a StructuredLogEntry event with a schema_id: Symbol, a severity enum (Info/Warn/Error), and a typed fields map so off-chain indexers can decode entries deterministically. Wire it as the low-level primitive that higher-level emitters delegate to.

Requirements and Context

  • New StructuredLogEntry event type in events.rs with a schema_id registry constant
  • Emitter helper EventEmitter::emit_structured(env, schema_id, severity, fields)
  • Backwards-compatible — existing typed events continue to fire
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b feature/structured-log-entry-events
  2. Implement changes
    • contracts/predictify-hybrid/src/events.rs
    • contracts/predictify-hybrid/src/tests/structured_log_entry_tests.rs
    • Document schema ids in docs/
  3. Test and commit
    • cargo test -p predictify-hybrid structured_log_entry
    • Cover edge cases
    • Include test output and notes in the PR

Example commit message

feat: add StructuredLogEntry event primitive with stable schema id

Acceptance Criteria

  • StructuredLogEntry is emittable from at least three existing call sites
  • schema_id constants are exported and documented
  • Decoder roundtrip test passes for every registered schema id

Guidelines

  • NatSpec-style /// doc comments on all new public items
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Labels

GRANTFOX OSSGrantFox open-source campaign taskOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveStellar Wave Program issueenhancementNew feature or improvementrustRust implementationsmart-contractSoroban smart-contract worksorobanSoroban SDK / Stellar

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions