Skip to content

🎨 Log: look up unknown compile-time formatted enum values#930

Merged
bdeane-intel merged 1 commit into
intel:mainfrom
elbeno:unnamed-enum-value-log
Jun 25, 2026
Merged

🎨 Log: look up unknown compile-time formatted enum values#930
bdeane-intel merged 1 commit into
intel:mainfrom
elbeno:unnamed-enum-value-log

Conversation

@elbeno

@elbeno elbeno commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Problem:

  • When an enumeration value is not named, but formatted at compile time, the resulting log string can potentially be post-processed by the decoder to recover the actual named enumeration value.

Solution:

  • Post-process the log string during decoding and look up an enumeration values that are available.

For example, given the C++ code:

enum struct E {}; // no values
LOG("Value is {}", stdx::ct<E{42}>);

The resulting log string is "Value is (E)42".

Even though E has no values known to C++, if there is extra information in the JSON that the decoder can use:

"enums": {
  "E": {
    "42": "the_answer"
  }
}

Then the log string can be post-processed during decoding to read "Value is the_answer"

Problem:
- When an enumeration value is not named, but formatted at compile time, the
  resulting log string can potentially be post-processed by the decoder to
  recover the actual named enumeration value.

Solution:
- Post-process the log string during decoding and look up an enumeration values
  that are available.

For example, given the C++ code:

```cpp
enum struct E {}; // no values
LOG("Value is {}", stdx::ct<E{42}>);
```

The resulting log string is `"Value is (E)42"`.

Even though `E` has no values known to C++, if there is extra information in the
JSON that the decoder can use:

```js
"enums": {
  "E": {
    "42": "the_answer"
  }
}
```

Then the log string can be post-processed during decoding to read `"Value is the_answer"`
@bdeane-intel
bdeane-intel merged commit 4400be2 into intel:main Jun 25, 2026
28 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