Add --verbosity,-l command line option

Allow to fine-control logging verbosity via command line
and LogPolicy setting (useful when OSRM used as library).

Closes #4299
This commit is contained in:
Mateusz Loskot
2017-08-28 21:20:13 +02:00
committed by Patrick Niklaus
parent fb5bd818d9
commit 7323221e3b
13 changed files with 144 additions and 38 deletions
+10 -3
View File
@@ -7,9 +7,10 @@
enum LogLevel
{
logINFO,
logWARNING,
logNONE,
logERROR,
logWARNING,
logINFO,
logDEBUG
};
@@ -27,14 +28,20 @@ class LogPolicy
bool IsMute() const;
LogLevel GetLevel() const;
void SetLevel(LogLevel level);
void SetLevel(std::string const &level);
static LogPolicy &GetInstance();
static std::string GetLevels();
LogPolicy(const LogPolicy &) = delete;
LogPolicy &operator=(const LogPolicy &) = delete;
private:
LogPolicy() : m_is_mute(true) {}
LogPolicy() : m_is_mute(true), m_level(logINFO) {}
std::atomic<bool> m_is_mute;
LogLevel m_level;
};
class Log