[Orxonox-commit 1282] r6000 - code/branches/console/src/libraries/util
rgrieder at orxonox.net
rgrieder at orxonox.net
Wed Oct 28 11:18:20 CET 2009
Author: rgrieder
Date: 2009-10-28 11:18:20 +0100 (Wed, 28 Oct 2009)
New Revision: 6000
Modified:
code/branches/console/src/libraries/util/OutputHandler.cc
Log:
Resolved a bug causing the static initialisation of the OutputHandler to go nuts.
Modified: code/branches/console/src/libraries/util/OutputHandler.cc
===================================================================
--- code/branches/console/src/libraries/util/OutputHandler.cc 2009-10-28 10:06:14 UTC (rev 5999)
+++ code/branches/console/src/libraries/util/OutputHandler.cc 2009-10-28 10:18:20 UTC (rev 6000)
@@ -62,8 +62,14 @@
class LogFileWriter : public OutputListener
{
public:
- //! Gets temporary log path and starts the log file
- LogFileWriter()
+ /**
+ @brief
+ Gets temporary log path and starts the log file
+ @param outputHandler
+ This is only required to avoid another call to getInstance (this c'tor was
+ called from getInstance!)
+ */
+ LogFileWriter(OutputHandler& outputHandler)
: OutputListener(OutputHandler::logFileOutputListenerName_s)
{
// Get path for a temporary file
@@ -86,8 +92,8 @@
this->outputStream_ = &this->logFile_;
// Use default level until we get the configValue from the Core
- OutputHandler::getInstance().setSoftDebugLevel(this->getOutputListenerName(), OutputLevel::Debug);
- OutputHandler::getInstance().registerOutputListener(this);
+ outputHandler.setSoftDebugLevel(this->getOutputListenerName(), OutputLevel::Debug);
+ outputHandler.registerOutputListener(this);
}
//! Closes the log file
@@ -133,14 +139,20 @@
public:
friend class OutputHandler;
- //! Sets the right soft debug level and registers itself
- MemoryLogWriter()
+ /**
+ @brief
+ Sets the right soft debug level and registers itself
+ @param outputHandler
+ This is only required to avoid another call to getInstance (this c'tor was
+ called from getInstance!)
+ */
+ MemoryLogWriter(OutputHandler& outputHandler)
: OutputListener("memoryLog")
{
this->outputStream_ = &this->buffer_;
// We capture as much input as the listener with the highest level
- OutputHandler::getInstance().setSoftDebugLevel(this->getOutputListenerName(), OutputHandler::getSoftDebugLevel());
- OutputHandler::getInstance().registerOutputListener(this);
+ outputHandler.setSoftDebugLevel(this->getOutputListenerName(), OutputHandler::getSoftDebugLevel());
+ outputHandler.registerOutputListener(this);
}
//! Pushed the just written output to the internal array
@@ -169,8 +181,8 @@
OutputHandler::OutputHandler()
: outputLevel_(OutputLevel::Verbose)
{
- this->logFile_ = new LogFileWriter();
- this->output_ = new MemoryLogWriter();
+ this->logFile_ = new LogFileWriter(*this);
+ this->output_ = new MemoryLogWriter(*this);
}
//! Destroys the LogFileWriter and the MemoryLogWriter
More information about the Orxonox-commit
mailing list