logging: avoid empty " :" prefix
This could happen when using item operations on the command line. In that case a source without name was created and that empty name was inserted as prefix before errors encountered while using the source. Now empty string is the same as no string.
This commit is contained in:
parent
de8461f802
commit
c95bc08e61
|
@ -192,6 +192,9 @@ void Logger::formatLines(Level msglevel,
|
|||
if (!firstLine.empty()) {
|
||||
print(firstLine, 1);
|
||||
}
|
||||
if (prefix && prefix->empty()) {
|
||||
prefix = NULL;
|
||||
}
|
||||
tag = StringPrintf("[%s%s%s] %s%s",
|
||||
levelToStr(msglevel),
|
||||
procname.c_str(),
|
||||
|
@ -259,7 +262,7 @@ Logger::MessageOptions::MessageOptions(Level level,
|
|||
const char *function,
|
||||
int flags) :
|
||||
m_level(level),
|
||||
m_prefix(prefix),
|
||||
m_prefix((!prefix || prefix->empty()) ? NULL : prefix),
|
||||
m_file(file),
|
||||
m_line(line),
|
||||
m_function(function),
|
||||
|
|
Loading…
Reference in New Issue