From 3f442039845a7b30fcf554c9820aab2ef3db5e7c Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Wed, 5 Nov 2014 11:42:40 -0800 Subject: [PATCH] remove getpid usage and replace with Qt solution --- libraries/shared/src/LogHandler.cpp | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/libraries/shared/src/LogHandler.cpp b/libraries/shared/src/LogHandler.cpp index a13f3a9dad..6abfd9e787 100644 --- a/libraries/shared/src/LogHandler.cpp +++ b/libraries/shared/src/LogHandler.cpp @@ -12,15 +12,7 @@ #include -#ifdef _WIN32 -#include -#define getpid _getpid -#define getppid _getpid // hack to build -#define pid_t int // hack to build -#elif __linux__ -#include // for getpid() on linux -#endif - +#include #include #include @@ -122,14 +114,8 @@ QString LogHandler::printMessage(LogMsgType type, const QMessageLogContext& cont prefixString.append(QString(" [%1]").arg(dateString)); if (_shouldOutputPID) { - prefixString.append(QString(" [%1").arg(getpid())); + prefixString.append(QString(" [%1]").arg(QCoreApplication::instance()->applicationPid())); - pid_t parentProcessID = getppid(); - if (parentProcessID != 0) { - prefixString.append(QString(":%1]").arg(parentProcessID)); - } else { - prefixString.append("]"); - } } if (!_targetName.isEmpty()) {