Skip to content
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

Forward Qt logging to Rust log!() facade #86

Merged
merged 12 commits into from
May 2, 2020
Merged

Conversation

ratijas
Copy link
Collaborator

@ratijas ratijas commented Apr 30, 2020

This is an implementation of proposal #85.

@ratijas
Copy link
Collaborator Author

ratijas commented Apr 30, 2020

  • I'd like to implement coercion of Qt/Rust logging levels using From/Into traits before merge 🤔
  • Also, front-page documentation should be update to advocate usage of forwarding logging facility.

qmetaobject/Cargo.toml Outdated Show resolved Hide resolved
qmetaobject/src/log.rs Outdated Show resolved Hide resolved
Copy link
Member

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

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

Looks good, thanks. I'll merge soon.

@@ -11,13 +11,15 @@ keywords = ["Qt", "QML", "QMetaObject",]
repository = "https://github.com/woboq/qmetaobject-rs"

[features]
default = ["log"]
Copy link
Member

Choose a reason for hiding this comment

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

Thanks. I'm just concerned about having too many dependencies. That's also why i wouldn't put it as the default either.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think debugging is essential, especially on such multi-lingua projects, and should be on by default. By having it on by default AND providing instructions for activation on the front-page example we are lowering the barrier for newcomers.


### `log`

By default, Qt's logging system is not initialized, and messages from e.g. QML's `console.log` don't go anywhere.
Copy link
Member

Choose a reason for hiding this comment

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

Don't they go in the stderr by default?

I mean, they follow the default Qt handler which is also quite configurable with env variable: https://doc.qt.io/qt-5/debug.html#warning-and-debugging-messages / https://doc.qt.io/qt-5/qloggingcategory.html#configuring-categories

Copy link
Collaborator Author

@ratijas ratijas May 1, 2020

Choose a reason for hiding this comment

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

Idk, by default they just not showing up at all on my system. I haven't been able to figure out why, but now, after manual activation, it works, which is fine for me.

@ratijas
Copy link
Collaborator Author

ratijas commented May 1, 2020

Breaking change incoming: 3da8fe7

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.

2 participants