Helper to map string to log priority
This commit is contained in:
parent
a128272816
commit
7fc82a26bf
@ -451,7 +451,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void run()
|
void run() override
|
||||||
{
|
{
|
||||||
while (1) {
|
while (1) {
|
||||||
LogEntry entry(m_entries.pop());
|
LogEntry entry(m_entries.pop());
|
||||||
@ -737,6 +737,16 @@ logstream::set_log_classes( sgDebugClass c)
|
|||||||
d->setLogLevels(c, d->m_logPriority);
|
d->setLogLevels(c, d->m_logPriority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sgDebugPriority logstream::priorityFromString(const std::string& s)
|
||||||
|
{
|
||||||
|
if (s == "bulk") return SG_BULK;
|
||||||
|
if (s == "debug") return SG_DEBUG;
|
||||||
|
if (s == "info") return SG_INFO;
|
||||||
|
if (s == "warn") return SG_WARN;
|
||||||
|
if (s == "alert") return SG_ALERT;
|
||||||
|
|
||||||
|
throw std::invalid_argument("Couldn't parse log prioirty:" + s);
|
||||||
|
}
|
||||||
|
|
||||||
logstream&
|
logstream&
|
||||||
sglog()
|
sglog()
|
||||||
|
@ -105,6 +105,11 @@ public:
|
|||||||
|
|
||||||
sgDebugPriority get_log_priority() const;
|
sgDebugPriority get_log_priority() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
@brief convert a string value to a log prioirty.
|
||||||
|
throws std::invalid_argument if the string is not valid
|
||||||
|
*/
|
||||||
|
static sgDebugPriority priorityFromString(const std::string& s);
|
||||||
/**
|
/**
|
||||||
* set developer mode on/off. In developer mode, SG_DEV_WARN messags
|
* set developer mode on/off. In developer mode, SG_DEV_WARN messags
|
||||||
* are treated as warnings. In normal (non-developer) mode they are
|
* are treated as warnings. In normal (non-developer) mode they are
|
||||||
|
Loading…
Reference in New Issue
Block a user