@brief Logger-Wrapper that allows to stream to the logger. @usage LASMessageStream(LAS_FATAL_ERROR) << "Pi is approximately: " << LASMessageStream().precision(2) << 3.14159 << std::endl;
| 74 | // @brief Logger-Wrapper that allows to stream to the logger. |
| 75 | // @usage LASMessageStream(LAS_FATAL_ERROR) << "Pi is approximately: " << LASMessageStream().precision(2) << 3.14159 << std::endl; |
| 76 | class LASMessageStream |
| 77 | { |
| 78 | public: |
| 79 | LASMessageStream(LAS_MESSAGE_TYPE type) : setType(type) {} |
| 80 | ~LASMessageStream() { if (setType != LAS_QUIET) LASMessage(setType, usedStream.str().c_str()); } |
| 81 | |
| 82 | template <typename T> |
| 83 | LASMessageStream& operator<<(const T& value) |
| 84 | { |
| 85 | usedStream << value; |
| 86 | return *this; |
| 87 | } |
| 88 | |
| 89 | // just in case someone streams std::endl ... |
| 90 | LASMessageStream& operator<<(std::ostream& (*func)(std::ostream&)); |
| 91 | LASMessageStream& precision(int prec); |
| 92 | |
| 93 | private: |
| 94 | LAS_MESSAGE_TYPE setType; |
| 95 | std::ostringstream usedStream; |
| 96 | }; |
| 97 | |
| 98 | #define logdebug LASMessageStream(LAS_DEBUG) |
| 99 | #define logveryverbose LASMessageStream(LAS_VERY_VERBOSE) |
nothing calls this directly
no outgoing calls
no test coverage detected