Skip to content

Logging fmt syntax#4682

Draft
tarek-y-ismail wants to merge 9 commits intomainfrom
logging-fmt-syntax
Draft

Logging fmt syntax#4682
tarek-y-ismail wants to merge 9 commits intomainfrom
logging-fmt-syntax

Conversation

@tarek-y-ismail
Copy link
Contributor

Closes #???

What's new?

  • Converts mir::log_* and Logger to use brace format syntax.

How to test

Read the code

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 107 out of 107 changed files in this pull request and generated 13 comments.

Comment on lines +175 to +176
auto const devnode = mgc::value_or(device.devnode(), "");
mir::log_debug("Quirks(egl-destroy-surface): checking device with devnode: {}, driver {}", devnode, driver);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing nulls as format arguments crashes.

Copy link
Contributor

Copilot AI commented Feb 16, 2026

@tarek-y-ismail I've opened a new pull request, #4687, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI added a commit that referenced this pull request Feb 16, 2026
After investigation, keeping both the variadic C-style overload and the template
std::format-based overload causes unavoidable ambiguity according to ISO C++. The
standard treats variadic functions specially in overload resolution, making both
overloads match even when the template is technically a better match.

Since PR #4682 already converts all usage to the new std::format-based API, we
accept this as a breaking change and remove the deprecated variadic overload.

Migration: Change printf-style format specifiers (%) to std::format style ({}).

Co-authored-by: tarek-y-ismail <[email protected]>
@Saviq Saviq mentioned this pull request Feb 16, 2026
3 tasks
@tarek-y-ismail
Copy link
Contributor Author

tarek-y-ismail commented Feb 16, 2026

Having both va list and brace style logging functions (mir::logging::log and Logger::log) with the same name is ambiguous. The compiler isn't smart enough to distinguish between them through the format string (would be neato!). I see two options:

  1. We remove the old functions, breaking ABI and API ❌
  2. We add the new ones with a different name or under a different namespace, log_fmt or mir::log2::log for example.

@tarek-y-ismail
Copy link
Contributor Author

Gradual transition options I can think of at the moment include:

  1. Introducing a new logging namespace, users/us can the transition to use this on a call-by-call basis
  2. Introducing a preprocessor macro to switch between the two implementations on a file-by-file basis.

@AlanGriffiths
Copy link
Contributor

Gradual transition options I can think of at the moment include:

1. Introducing a new logging namespace, users/us can the transition to use this on a call-by-call basis

2. Introducing a preprocessor macro to switch between the two implementations on a file-by-file basis.

Provided both APIs are available I don't see the need for either of these options. Each call site requires updating the format string, changing the function called can happen at the same time.

@tarek-y-ismail
Copy link
Contributor Author

Provided both APIs are available

That's the catch. see #4682 (comment)

github-merge-queue bot pushed a commit that referenced this pull request Feb 17, 2026
Closes #4682

## What's new?

They require a working graphics setup, which we can't reliably expect in
CI.

## How to test

TICS passes.

## Checklist

- [x] Tests added and pass
- [ ] Adequate documentation added
- [ ] (optional) Added Screenshots or videos
@Saviq Saviq reopened this Feb 17, 2026
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.

5 participants