| 266 | }; |
| 267 | |
| 268 | class Coloured |
| 269 | { |
| 270 | public: |
| 271 | explicit Coloured(std::ostream& stream) |
| 272 | : mStream(stream) |
| 273 | // TODO: check which stream is stderr? |
| 274 | , mUseColor(useColoredOutput()) |
| 275 | { |
| 276 | } |
| 277 | |
| 278 | void write(const char* str, std::streamsize size, Level level) |
| 279 | { |
| 280 | if (mUseColor) |
| 281 | mStream << "\033[0;" << getColor(level) << 'm'; |
| 282 | mStream.write(str, size); |
| 283 | if (mUseColor) |
| 284 | mStream << "\033[0;" << Reset << 'm'; |
| 285 | mStream.flush(); |
| 286 | } |
| 287 | |
| 288 | private: |
| 289 | std::ostream& mStream; |
| 290 | bool mUseColor; |
| 291 | }; |
| 292 | |
| 293 | class Buffer |
| 294 | { |
no outgoing calls
no test coverage detected