Skip to content

Use Qt's public logging APIs rather than undocumented internals #1300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jnbooth
Copy link
Contributor

@jnbooth jnbooth commented Jun 25, 2025

Instead of exposing undocumented internal features of Qt, qtlogging.rs now exports q_critical, q_debug, q_fatal, q_info, and q_warning, equivalent to Qt's qCritical, qDebug, qFatal, qInfo, and qWarning. So instead of doing this:

qt_message_output(
  QtMsgType::QtInfoMsg,
  &QMessageLogContext::new(c"myfile.rs", 1, c"", c"default"),
  &QString::from(&format!("Test message: {x} / {y}"))
);

You can simply do this:

q_info!("Test message: {x} / {y}");

The file and line number are automatically filled in by the file and line built-in macros.

Copy link

codecov bot commented Jun 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (cb64b22) to head (a3ddf73).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1300   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           75        75           
  Lines        12772     12772           
=========================================
  Hits         12772     12772           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant