summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qlogging.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@digia.com>2014-09-24 09:55:02 +0200
committerKai Koehne <kai.koehne@digia.com>2014-10-01 16:06:27 +0200
commitd78fb442d750b33afe2e41f31588ec94cf4023ad (patch)
tree15bed899511153580fae3a4cc24ff7dc16260e85 /src/corelib/global/qlogging.cpp
parent377ef06aefd66c67c8d65d9e3cb3137b506c6014 (diff)
Logging: Disable tracking of debug source info for release builds
Tracking the file, line, function means the information has to be stored in the binaries, enlarging the size. It also might be a surprise to some commercial customers that their internal file & function names are 'leaked'. Therefore we enable it for debug builds only. [ChangeLog][QtCore][Logging] File, line, function information are not recorded anymore for logging statements in release builds. Set QT_MESSAGELOGCONTEXT explicitly to enable recording in all configurations. Change-Id: I454bdb42bcf5b5a8de6507f29f2a61109dca9b91 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com> Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Diffstat (limited to 'src/corelib/global/qlogging.cpp')
-rw-r--r--src/corelib/global/qlogging.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp
index 575f484dd3..2a4f2dd4d6 100644
--- a/src/corelib/global/qlogging.cpp
+++ b/src/corelib/global/qlogging.cpp
@@ -174,6 +174,9 @@ Q_CORE_EXPORT bool qt_logging_to_console()
The class provides information about the source code location a qDebug(), qWarning(),
qCritical() or qFatal() message was generated.
+ \note By default, this information is recorded only in debug builds. You can overwrite
+ this explicitly by defining \c QT_MESSAGELOGCONTEXT or \c{QT_NO_MESSAGELOGCONTEXT}.
+
\sa QMessageLogger, QtMessageHandler, qInstallMessageHandler()
*/
@@ -185,8 +188,9 @@ Q_CORE_EXPORT bool qt_logging_to_console()
QMessageLogger is used to generate messages for the Qt logging framework. Usually one uses
it through qDebug(), qWarning(), qCritical, or qFatal() functions,
- which are actually macros that expand to QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debug()
- et al.
+ which are actually macros: For example qDebug() expands to
+ QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO).debug()
+ for debug builds, and QMessageLogger(0, 0, 0).debug() for release builds.
One example of direct use is to forward errors that stem from a scripting language, e.g. QML: