spine-runtimes/todos/done/2025-01-21-18-49-54-logging-indentation.md
Mario Zechner 6f81d43faa [cpp] Enhance circular reference display with deterministic object identifiers
Replace "<circular>" with meaningful reference strings using a hybrid approach:
- Objects with names: <EventData-walk>, <BoneData-head>, <Animation-run>
- Objects without names: <TrackEntry-1>, <Bone-2>, <SliderTimeline-3>

Each serialized object now includes "refString" as its first field, enabling
easy navigation from circular references to full object definitions.
2025-07-22 02:09:01 +02:00

1.5 KiB

Improve bash script logging indentation for nested calls

Status: Done Agent PID: 30228

Original Todo

  • clean up logging in spine-c/codegen, use chalk to do colored warnings/errors and make logging look very nice and informative (no emojis)

Description

Implement automatic indentation for bash script logging when scripts call other scripts. Currently, when a script calls another script, both use the same logging functions from formatters/logging/logging.sh, making it difficult to distinguish the call hierarchy. The solution will detect script nesting level by analyzing the process tree and automatically indent log output from child scripts.

Implementation Plan

  • Create process tree analysis utility to detect script nesting level
  • Add nesting level detection that runs once when logging.sh is sourced
  • Store indentation level in a local variable (SPINE_LOG_INDENT_SPACES) - not exported
  • Modify log_action(), log_warn(), and log_detail() to use the pre-calculated local indentation
  • Test with nested script calls (format.sh calling format-cpp.sh, etc.)
  • Ensure backward compatibility and graceful fallback if detection fails
  • Update documentation to explain the new indentation behavior
  • Add script filename to log_title output for better clarity

Notes

26 bash scripts in the codebase use logging.sh functionality, including build, test, format, setup, and publish scripts. All would benefit from proper indentation when calling each other.