Bug 1470508 Output the process name in MOZ_LOG r=froydnj

This commit is contained in:
Tom Ritter 2018-06-22 12:31:35 -05:00
Родитель 9cbfdc7c2d
Коммит 102b854208
3 изменённых файлов: 16 добавлений и 4 удалений

Просмотреть файл

@ -19,6 +19,7 @@
#include "MainThreadUtils.h"
#include "nsClassHashtable.h"
#include "nsDebug.h"
#include "nsDebugImpl.h"
#include "NSPRLogModulesParser.h"
#include "LogCommandLineHandler.h"
@ -463,8 +464,8 @@ public:
if (!mAddTimestamp) {
if (!mIsRaw) {
fprintf_stderr(out,
"[%ld:%s]: %s/%s %s%s",
pid, currentThreadName, ToLogStr(aLevel),
"[%s %ld: %s]: %s/%s %s%s",
nsDebugImpl::GetMultiprocessMode(), pid, currentThreadName, ToLogStr(aLevel),
aName, buffToWrite, newline);
} else {
fprintf_stderr(out, "%s%s", buffToWrite, newline);
@ -474,10 +475,10 @@ public:
PR_ExplodeTime(PR_Now(), PR_GMTParameters, &now);
fprintf_stderr(
out,
"%04d-%02d-%02d %02d:%02d:%02d.%06d UTC - [%ld:%s]: %s/%s %s%s",
"%04d-%02d-%02d %02d:%02d:%02d.%06d UTC - [%s %ld: %s]: %s/%s %s%s",
now.tm_year, now.tm_month + 1, now.tm_mday,
now.tm_hour, now.tm_min, now.tm_sec, now.tm_usec,
pid, currentThreadName, ToLogStr(aLevel),
nsDebugImpl::GetMultiprocessMode(), pid, currentThreadName, ToLogStr(aLevel),
aName, buffToWrite, newline);
}

Просмотреть файл

@ -221,6 +221,12 @@ nsDebugImpl::SetMultiprocessMode(const char* aDesc)
sMultiprocessDescription = aDesc;
}
/* static */ const char *
nsDebugImpl::GetMultiprocessMode()
{
return sMultiprocessDescription;
}
/**
* Implementation of the nsDebug methods. Note that this code is
* always compiled in, in case some other module that uses it is

Просмотреть файл

@ -19,6 +19,11 @@ public:
static nsresult Create(nsISupports* aOuter, const nsIID& aIID,
void** aInstancePtr);
/*
* If we are in multiprocess mode, return the process name.
*/
static const char* GetMultiprocessMode();
/*
* Inform nsDebugImpl that we're in multiprocess mode.
*