Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8780 for code


Ignore:
Timestamp:
Jul 25, 2011, 8:03:05 PM (13 years ago)
Author:
landauf
Message:

added ConsoleWriter

Location:
code/branches/output/src/libraries/util
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/libraries/util/CMakeLists.txt

    r8774 r8780  
    4343  output/OutputManager.cc
    4444  output/OutputListener.cc
     45  output/ConsoleWriter.cc
    4546  output/LogWriter.cc
    4647  output/MemoryWriter.cc
  • code/branches/output/src/libraries/util/output/OutputManager.cc

    r8777 r8780  
    2929#include "OutputManager.h"
    3030
    31 #include "util/Debug.h"
    32 #include "OutputListener.h"
    3331#include "MemoryWriter.h"
     32#include "ConsoleWriter.h"
    3433#include "LogWriter.h"
    3534
     
    3837namespace test
    3938{
    40     class ConsoleOutput : public OutputListener
    41     {
    42         public:
    43             ConsoleOutput()
    44             {
    45                 this->setLevelMax(level::user_info);
    46             }
    47 
    48         protected:
    49             virtual void output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines)
    50             {
    51                 const std::string& prefix = OutputManager::getInstance().getDefaultPrefix(level, context);
    52                 std::string blanks(prefix.length(), ' ');
    53 
    54                 for (size_t i = 0; i < lines.size(); ++i)
    55                     COUT(0) << (i == 0 ? prefix : blanks) << lines[i] << endl;
    56             }
    57     };
    58 
    5939    OutputManager::OutputManager()
    6040    {
     
    7757        static OutputManager& instance = OutputManager::getInstance();
    7858
    79         static ConsoleOutput consoleOutputInstance;
    8059        static MemoryWriter& memoryWriterInstance = MemoryWriter::getInstance(); (void)memoryWriterInstance;
     60        static ConsoleWriter& consoleWriterInstance = ConsoleWriter::getInstance(); (void)consoleWriterInstance;
    8161        static LogWriter& logWriterInstance = LogWriter::getInstance(); (void)logWriterInstance;
    8262
     
    153133    OutputContext registerContext(const std::string& name)
    154134    {
    155         COUT(0) << "### register context " << name << std::endl;
    156135        return OutputManager::getInstance().registerContext(name);
    157136    }
Note: See TracChangeset for help on using the changeset viewer.