From 27bf83ee9a211154eb88494ee3e7810d953020f8 Mon Sep 17 00:00:00 2001 From: Lincoln Ramsay Date: Thu, 19 Apr 2012 18:22:19 +1000 Subject: Doc update. Change-Id: Ibb7b814016ab352d57ddf415d52ad73d3229de35 Reviewed-by: Wolfgang Beck --- src/logger/qlogger.cpp | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/logger/qlogger.h | 5 ++++ 2 files changed, 79 insertions(+) (limited to 'src') diff --git a/src/logger/qlogger.cpp b/src/logger/qlogger.cpp index 196b973..539c523 100644 --- a/src/logger/qlogger.cpp +++ b/src/logger/qlogger.cpp @@ -131,6 +131,19 @@ namespace QLoggingCategories } } +/*! + \namespace QLogging +*/ + +/*! + \relates QLogging + Load logging rules from \a path. + + If \a path is relative, QStandardPaths::writeableLocation(QStandardPaths::ConfigLocation) will be prepended. + + Note that if the QT_LOGGING_CONFIG environment variables points to a file, this function does nothing. + \sa QT_LOGGING_CONFIG +*/ void qSetLoggingRulesFile(const QString &path) { if (gEnvironment == EnvironmentNotChecked) checkEnvironment(); @@ -140,6 +153,16 @@ void qSetLoggingRulesFile(const QString &path) qLogging()->setLoggingRulesFile(config); } +/*! + \relates QLogging + Set logging \a rules directly. + + This is primarily intended for applications that wish to provide runtime control of their + logging rather than relying on the user providing a configuration file. + + Note that if the QT_LOGGING_CONFIG environment variables points to a file, this function does nothing. + \sa QT_LOGGING_CONFIG +*/ void qSetLoggingRules(const QByteArray &rules) { if (gEnvironment == EnvironmentNotChecked) checkEnvironment(); @@ -148,6 +171,57 @@ void qSetLoggingRules(const QByteArray &rules) qLogging()->setLoggingRules(rules); } +/*! + \relates QLogging + \macro qCDebug(cat) + Works like qDebug() but only prints out if \a cat has been enabled. + \code + qCDebug(CAT) << "my message"; + \endcode + \sa QT_LOG_CATEGORY(), {Creating Logging Rules} +*/ + +/*! + \relates QLogging + \macro qCWarning(cat) + Works like qWarning() and can be disabled with \a cat. + \code + qCWarning(CAT) << "my message"; + \endcode + \sa QT_LOG_CATEGORY(), {Creating Logging Rules} +*/ + +/*! + \relates QLogging + \macro qCCritical(cat) + Works like qCritical() and can be disabled with \a cat. + \code + qCCritical(CAT) << "my message"; + \endcode + \sa QT_LOG_CATEGORY(), {Creating Logging Rules} +*/ + +/*! + \relates QLogging + \macro QT_LOG_CATEGORY(cat, identifier) + Registers a logging category with local identifier \a cat and complete identifier \a identifier. + + This macro must be used outside of a class or method. + \sa {Logging usage in your project} +*/ + + + + + + + + + + + + + /*! \internal QLoggingPrivate constructor diff --git a/src/logger/qlogger.h b/src/logger/qlogger.h index 400dccc..ce06201 100644 --- a/src/logger/qlogger.h +++ b/src/logger/qlogger.h @@ -66,6 +66,11 @@ namespace QLoggingCategories { Q_LOGGER_EXPORT bool isEnabled(); } +// This is here so that QDoc has something to attach the functions +// and macros to. +namespace QLogging { +} + Q_LOGGER_EXPORT void qSetLoggingRules(const QByteArray &rules); Q_LOGGER_EXPORT void qSetLoggingRulesFile(const QString &path); -- cgit v1.2.3