Skip to content

New Runtime Lifecycle log section.#850

Merged
gbin merged 7 commits into
masterfrom
gbin/logger-context
Feb 21, 2026
Merged

New Runtime Lifecycle log section.#850
gbin merged 7 commits into
masterfrom
gbin/logger-context

Conversation

@gbin

@gbin gbin commented Feb 21, 2026

Copy link
Copy Markdown
Collaborator

Summary

We miss the context from which a log was created and this is critical with Copper because the user needs to resim it with the same binary / mission / config etc...

This PR moves the config context from the text log to this and adds:

  • mission info
  • git info

and generally a trace of what happened when in terms of runtime lifecycle -> crash? stop? change of mission? etc.

you use this command to dump this info:

   Running `/home/gbin/projects/copper/copper-rs.logger-context/target/release/balancebot-logreader logs/balance.copper fsck --dump-runtime-lifecycle`
    RuntimeLifecycle #1 @3.239 ms
      event: Instantiated
      config_source: ExternalFile
      stack:
        app_name: cu-rp-balancebot
        app_version: 0.13.1
        git_commit: a6a22f810d920c701a0aaec613bdb7df56104af0
        git_dirty: n/a
      effective_config_ron:
        (
            tasks: [
                (
                    id: "balpos",
                    type: "cu_ads7883_new::ADS7883",
                    missions: None,
                ),
                (
                    id: "railpos",
                    type: "cu_rp_encoder::Encoder",
                    config: {
                        "clk_pin": 26,
                        "dat_pin": 20,
                    },
                    missions: None,
                ),
                (
                    id: "balpos_pid",
                    type: "tasks::BalPID",
                    config: {
                        "kp": 0.015,
                        "cutoff": 170.0,
                        "setpoint": 3072.0,
                        "kd": 0.01,
                        "ki": 0.0,
                    },
                    missions: None,
                ),
                (
                    id: "railpos_pid",
                    type: "tasks::PosPID",
                    config: {
                        "kd": 0.8,
                        "kp": 0.0005,
                        "cutoff": 1000.0,
                        "ki": 0.0,
                        "sampling_ms": 100,
                        "setpoint": 0.0,
                    },
                    missions: None,
                ),
                (
                    id: "merge_pids",
                    type: "tasks::PIDMerger",
                    missions: None,
                ),
                (
                    id: "motor",
                    type: "cu_rp_sn754410_new::SN754410",
                    config: {
                        "deadzone": 0.3,
                        "dryrun": false,
                    },
                    missions: None,
                ),
            ],
            resources: None,
            bridges: None,
            cnx: [
                (
                    src: "balpos",
                    dst: "balpos_pid",
                    msg: "cu_ads7883_new::ADSReadingPayload",
                    missions: None,
                ),
                (
                    src: "railpos",
                    dst: "railpos_pid",
                    msg: "cu_rp_encoder::EncoderPayload",
                    missions: None,
                ),
                (
                    src: "balpos_pid",
                    dst: "merge_pids",
                    msg: "cu_pid::PIDControlOutputPayload",
                    missions: None,
                ),
                (
                    src: "railpos_pid",
                    dst: "merge_pids",
                    msg: "cu_pid::PIDControlOutputPayload",
                    missions: None,
                ),
                (
                    src: "merge_pids",
                    dst: "motor",
                    msg: "cu_rp_sn754410_new::MotorPayload",
                    missions: None,
                ),
            ],
            monitor: (
                type: "cu_consolemon::CuConsoleMon",
            ),
            logging: None,
            runtime: None,
            missions: None,
            includes: None,
        )
    RuntimeLifecycle #2 @3.452 ms
      event: MissionStarted
      mission: default
    RuntimeLifecycle #3 @18.505 s
      event: MissionStopped
      mission: default
      reason: stop_all_tasks
    RuntimeLifecycle #4 @18.505 s
      event: ShutdownCompleted

Related issues

  • Closes #

Changes

Testing

  • just fmt
  • just lint
  • just test
  • optional full just std-ci (if std/runtime paths are impacted)
  • optional full just nostd-ci (if embedded/no_std paths are impacted)
  • Other (please specify):

pro-tip: just with no parameters in the root defaults to just fmt, just lint, and just test.

Checklist

  • I have updated docs or examples where needed
  • I have added or updated tests where needed
  • I have considered platform impact (Linux/macOS/Windows/embedded)
  • I have considered config/logging changes (if applicable)
  • This change is not a breaking change (or I documented it below)

Breaking changes (if any)

Additional context

@gbin gbin added enhancement New feature or request include in changelog labels Feb 21, 2026
@gbin gbin merged commit 79d1c25 into master Feb 21, 2026
23 checks passed
@gbin gbin deleted the gbin/logger-context branch February 21, 2026 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant