Skip to content

Conversation

@elbeno
Copy link
Contributor

@elbeno elbeno commented Jan 20, 2026

Problem:

  • When outputting log information to JSON, some information is lost from the
    format_result: namely the types and resulting spans (string locations) of
    the values that were compile-time formatted.

Solution:

  • Adjust format_result to include information about all values and their
    locations in the format string.

Problem:
- When outputting log information to JSON, some information is lost from the
  `format_result`: namely the types and resulting spans (string locations) of
  the values that were compile-time formatted.

Solution:
- Adjust `format_result` to include information about all values and their
  locations in the format string.
@elbeno elbeno changed the title Fmt spans ✨ Include span information in format_result Jan 20, 2026
@elbeno elbeno force-pushed the fmt-spans branch 3 times, most recently from 48479de to fe530eb Compare January 20, 2026 17:19
@lukevalenty
Copy link
Contributor

lukevalenty commented Jan 20, 2026

Is the intention for locations of both runtime and compile-time values to be listed in the spans? For example, spans for compile-time values would show the start and end of the actual compile-time value string representation in the formatted string...and spans for runtime-values would show the start and end of the format specifier "{...}".

ETA: I am indifferent to the result, just curious to know which direction this is going in.

@lukevalenty
Copy link
Contributor

lukevalenty commented Jan 20, 2026

What happens when format results are formatted into another format result? I would expect to see multiple spans.

For example:

auto introduction = format("my name is {}"_cts, "Luke"_cts);
auto result = format("hello, {}"_cts, introduction);

// span 0                       |-------------|
// span 1                                  |--|
static_assert(result == "hello, my name is Luke"_cts);

I would expect a span for each substituted compile-time value at each level.

Problem:
- Formatting of move-only types does not work.

Solution:
- Move the values through the formatting machinery appropriately.
@elbeno
Copy link
Contributor Author

elbeno commented Jan 20, 2026

  • It is the intent to treat runtime and compile-time args mostly the same; in particular to have both types represented in the argument list and the spans list. Makes back-end treatment easier.
  • When a format_result is interpolated, the resulting format_result is flattened, not nested. This was already the case and this PR continues that. It's much easier to deal with.

@elbeno elbeno marked this pull request as ready for review January 20, 2026 18:29
@bdeane-intel bdeane-intel merged commit c790114 into intel:main Jan 21, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants