Commit 2522336d authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - colors can be turned globally of now

parent ed08b3bc
......@@ -43,7 +43,8 @@ WLogger::WLogger( std::string fileName, LogLevel level ):
m_STDERRLevel( LL_ERROR ),
m_LogFileLevel( level ),
m_LogFileName( fileName ),
m_QueueMutex()
m_QueueMutex(),
m_colored( true )
{
logger = this;
......@@ -98,7 +99,7 @@ void WLogger::addLogMessage( std::string message, std::string source, LogLevel l
boost::posix_time::ptime t( boost::posix_time::second_clock::local_time() );
std::string timeString( to_simple_string( t ) );
WLogEntry entry( timeString, message, level, source );
WLogEntry entry( timeString, message, level, source, m_colored );
// NOTE: in DEBUG mode, we do not use the process queue, since it prints messages delayed and is, therefore, not very usable during debugging.
#ifndef DEBUG
......@@ -161,3 +162,13 @@ void WLogger::threadMain()
#endif
}
void WLogger::setColored( bool colors )
{
m_colored = colors;
}
bool WLogger::isColored()
{
return m_colored;
}
......@@ -86,6 +86,20 @@ public:
*/
void setLogFileName( std::string fileName );
/**
* Set whether to use colors or not. Note: this is only useful on Linux systems currently.
*
* \param colors true if colors should be used.
*/
void setColored( bool colors );
/**
* Getter determining whether to use colors or not.
*
* \return true if colors should be used.
*/
bool isColored();
/**
* Appends a log message to the logging queue.
*/
......@@ -150,6 +164,11 @@ private:
* Mutex for doing locking due to thread-safety.
*/
boost::mutex m_QueueMutex;
/**
* Flag determining whether log entries can be colored or not.
*/
bool m_colored;
};
#endif // WLOGGER_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment