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

Update ctkLogger #1181

Merged
merged 3 commits into from
Jan 17, 2024
Merged

Update ctkLogger #1181

merged 3 commits into from
Jan 17, 2024

Conversation

jcfr
Copy link
Member

@jcfr jcfr commented Jan 17, 2024

  • Update ctkLogger adding support for log level: Set default level based on the build config.
  • Update ctkErrorLogLevel enum values defining "Unknown" as 0

@jcfr jcfr requested a review from lassoan January 17, 2024 11:14
@jcfr
Copy link
Member Author

jcfr commented Jan 17, 2024

@Punzo @lassoan There changes were originally part of #1165 and have been factored out into an independent pull request.

@jcfr
Copy link
Member Author

jcfr commented Jan 17, 2024

Now that we removed support for Qt4, for new classes, I think we should instead standardize on using QLoggingCategory and avoid ctkLogger.

See https://doc.qt.io/qt-5/qloggingcategory.html

@Punzo
Copy link
Contributor

Punzo commented Jan 17, 2024

@Punzo @lassoan There changes were originally part of #1165 and have been factored out into an independent pull request.

ok, perfect!

Punzo and others added 3 commits January 17, 2024 14:04
This revisits the order of the `ctkErrorLogLevel` enum values to
align with the typical log level hierarchy—from verbose (i.e., Debug) to
less verbose (i.e., Critical). The "None" value has been moved to the end
of the enum to ensure it holds the largest value.

Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
Set ctkLogger default level is set based on the build configuration.
If a Debug build, the default log level is set as `ctkErrorLogLevel::LogLevel::Debug`
and it set as `ctkErrorLogLevel::LogLevel::Warning` otherwise.

The mapping of the logger functions is the following:

* `ctkLogger::trace()` -> `qDebug()
* `ctkLogger::debug()` -> `qDebug()`
* `ctkLogger::info()` -> `qInfo()`
* `ctkLogger::warn()` -> `qWarning()`
* `ctkLogger::error()` -> `qCritical()`
* `ctkLogger::fatal()` -> `qCritical()`

For convenience, the order of the function declaration has been updated
to match the ordering of log level (Trace < Fatal).

Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
@jcfr jcfr force-pushed the update-ctkLogger branch from 2a8f6e1 to 356fb51 Compare January 17, 2024 21:13
@jcfr
Copy link
Member Author

jcfr commented Jan 17, 2024

I revisited the default level associated with the ctkLogger functions and also added a multiple tests.

@jcfr jcfr merged commit 2f84abd into commontk:master Jan 17, 2024
3 checks passed
@jcfr jcfr deleted the update-ctkLogger branch January 17, 2024 21:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants