Changeset 8794 for code/branches/output
- Timestamp:
- Jul 28, 2011, 10:35:41 PM (13 years ago)
- Location:
- code/branches/output/src/libraries/util
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/output/src/libraries/util/CMakeLists.txt
r8787 r8794 42 42 output/OutputManager.cc 43 43 output/OutputListener.cc 44 output/BaseWriter.cc 44 45 output/ConsoleWriter.cc 45 46 output/LogWriter.cc -
code/branches/output/src/libraries/util/output/ConsoleWriter.cc
r8789 r8794 51 51 } 52 52 53 void ConsoleWriter:: output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines)53 void ConsoleWriter::printLine(const std::string& line) 54 54 { 55 const std::string& prefix = OutputManager::getInstance().getDefaultPrefix(level, context); 56 std::string blanks(prefix.length(), ' '); 57 58 for (size_t i = 0; i < lines.size(); ++i) 59 std::cout << (i == 0 ? prefix : blanks) << lines[i] << std::endl; 55 std::cout << line << std::endl; 60 56 } 61 57 -
code/branches/output/src/libraries/util/output/ConsoleWriter.h
r8787 r8794 31 31 32 32 #include "util/UtilPrereqs.h" 33 #include " OutputListener.h"33 #include "BaseWriter.h" 34 34 35 35 namespace orxonox 36 36 { 37 class _UtilExport ConsoleWriter : public OutputListener37 class _UtilExport ConsoleWriter : public BaseWriter 38 38 { 39 39 public: … … 44 44 45 45 protected: 46 virtual void output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines);46 virtual void printLine(const std::string& line); 47 47 48 48 private: 49 49 ConsoleWriter(); 50 50 ConsoleWriter(const ConsoleWriter&); 51 ~ConsoleWriter();51 virtual ~ConsoleWriter(); 52 52 53 53 bool bEnabled_; -
code/branches/output/src/libraries/util/output/LogWriter.cc
r8787 r8794 64 64 } 65 65 66 void LogWriter::output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines)67 {68 if (!this->file_.is_open())69 return;70 71 const std::string& prefix = OutputManager::getInstance().getDefaultPrefix(level, context);72 std::string blanks(prefix.length(), ' ');73 74 for (size_t i = 0; i < lines.size(); ++i)75 this->printLine((i == 0 ? prefix : blanks) + lines[i]);76 }77 78 66 void LogWriter::openFile() 79 67 { … … 114 102 void LogWriter::printLine(const std::string& line) 115 103 { 104 if (!this->file_.is_open()) 105 return; 106 116 107 // Get current time 117 108 time_t rawtime; -
code/branches/output/src/libraries/util/output/LogWriter.h
r8787 r8794 34 34 #include <fstream> 35 35 36 #include " OutputListener.h"36 #include "BaseWriter.h" 37 37 38 38 namespace orxonox 39 39 { 40 class _UtilExport LogWriter : public OutputListener40 class _UtilExport LogWriter : public BaseWriter 41 41 { 42 42 public: … … 46 46 47 47 protected: 48 virtual void output(OutputLevel level, OutputContext context, const std::vector<std::string>& lines);48 virtual void printLine(const std::string& line); 49 49 50 50 private: 51 51 LogWriter(); 52 52 LogWriter(const LogWriter&); 53 ~LogWriter();53 virtual ~LogWriter(); 54 54 55 55 void openFile(); 56 56 void closeFile(); 57 58 void printLine(const std::string& line);59 57 60 58 std::string filename_; -
code/branches/output/src/libraries/util/output/MemoryWriter.h
r8787 r8794 59 59 MemoryWriter(); 60 60 MemoryWriter(const MemoryWriter&); 61 ~MemoryWriter();61 virtual ~MemoryWriter(); 62 62 63 63 std::vector<Message> messages_; -
code/branches/output/src/libraries/util/output/OutputListener.h
r8787 r8794 42 42 public: 43 43 OutputListener(); 44 ~OutputListener();44 virtual ~OutputListener(); 45 45 46 46 void setLevelMax(OutputLevel max);
Note: See TracChangeset
for help on using the changeset viewer.