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

Classify Logs #39

Open
SchaichAlonso opened this issue Oct 20, 2023 · 1 comment
Open

Classify Logs #39

SchaichAlonso opened this issue Oct 20, 2023 · 1 comment
Labels
enhancement New feature or request general General category (if hard to assign to any other category)

Comments

@SchaichAlonso
Copy link
Contributor

TinyORM currently uses the QMessageLogger global singleton instance to emit diagnostics, which can be considered a pain on applications doing a lot of queries along alot of qDebug output in TinyORM-unrelated code. While per general policy, QMessageLogger's debug message emission can be turned off, disabling DEBUG level will shut it off for all unclassified qDebug statements in the application, whether originating from TinyORM or elsewhere.

Presumably for this reason, TinyORM does not emit diagnostics in release mode.

Swapping the TinyORM libraries, especially on MSVC builds which have varying ITERATOR_DEBUG_LEVEL breaking the compatibiliy between debug and release DLLs, however, might be unfeasible.

Qt Supports logging categories, which can be used to granularily turn on / off diagnostics per category, without having to recompile the corresponding code, and can also can help to classify the diagnostics in case a more sophisticated logging backend (nagios and friends) is configured .

Invent a log sink name for TinyORM, convert all qDebug to qCDebug and uncoditionally have them be generated. There's only 4-ish of them within library code, so it should be straightforward.

Note, however, that in order to be able to reconfigure the category on the fly, or to use it to emit messegas from an out-of-DLL context (tom-tool or the test suite messages), it needs to be declared using Q_DECLARE_EXPORTED_LOGGING_CATEGORY, with the second argument yielding the dllexport/dllimport declaring macro.

@silverqx silverqx added the enhancement New feature or request label Oct 21, 2023
@silverqx
Copy link
Owner

I know about this, first I read it in Qt Weekly #1: Categorized Logging and I like it, it has many more functions than the classic qDebug() macro.

I was thinking about using the qCDebug() a few months ago but it didn't happen.

@silverqx silverqx added the general General category (if hard to assign to any other category) label Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request general General category (if hard to assign to any other category)
Projects
None yet
Development

No branches or pull requests

2 participants