Revision 201e2bb8 src/main/milhouseLogger.cpp
| b/src/main/milhouseLogger.cpp | ||
|---|---|---|
| 26 | 26 |
#include <iostream> |
| 27 | 27 |
|
| 28 | 28 |
|
| 29 |
MilhouseLogger::MilhouseLogger(const std::string &logLevel) :
|
|
| 30 |
printQueue_(),
|
|
| 31 |
printThread_(boost::bind<void>(&MilhouseLogger::printMessages, this)),
|
|
| 32 |
gstDebug_(false),
|
|
| 29 |
MilhouseLogger::MilhouseLogger(const std::string &logLevel) : |
|
| 30 |
printQueue_(), |
|
| 31 |
printThread_(boost::bind<void>(&MilhouseLogger::printMessages, this)), |
|
| 32 |
gstDebug_(false), |
|
| 33 | 33 |
level_(argToLogLevel(logLevel)) |
| 34 | 34 |
{
|
| 35 | 35 |
} |
| ... | ... | |
| 44 | 44 |
strings["ERROR"] = strings["2"] = ERROR; |
| 45 | 45 |
strings["WARNING"] = strings["3"] = WARNING; |
| 46 | 46 |
strings["INFO"] = strings["4"] = INFO; |
| 47 |
strings["DEBUG"] = strings["5"] = DEBUG;
|
|
| 47 |
strings["DEBUG"] = strings["5"] = DEBUG; |
|
| 48 | 48 |
|
| 49 | 49 |
if (upperCase == "GST-DEBUG" or upperCase == "6") |
| 50 | 50 |
{
|
| ... | ... | |
| 72 | 72 |
/// This is called in the main thread |
| 73 | 73 |
void MilhouseLogger::operator()(LogLevel& level, std::string& msg) |
| 74 | 74 |
{
|
| 75 |
if (level_ <= level) // only push to print queue if the loglevel of this msg exceeds
|
|
| 75 |
if (level_ <= level) // only push to print queue if the loglevel of this msg exceeds |
|
| 76 | 76 |
printQueue_.push(msg); // the logger's loglevel |
| 77 | 77 |
} |
| 78 | 78 |
|
| ... | ... | |
| 84 | 84 |
{
|
| 85 | 85 |
std::string msg; |
| 86 | 86 |
printQueue_.wait_and_pop(msg); |
| 87 |
|
|
| 87 |
|
|
| 88 | 88 |
/// quit when msg starts with quit: |
| 89 | 89 |
if (msg != "quit:") |
| 90 | 90 |
std::cout << msg; |
Also available in: Unified diff