Skip to content

Classify Logs #39

@SchaichAlonso

Description

@SchaichAlonso

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgeneralGeneral category (if hard to assign to any other category)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions