I want to define a class `MyStream` so that:

```
MyStream myStream;
myStream << 1 << 2 << 3 << std::endl << 5 << 6 << std::endl << 7 << 8 << std::endl;

```

gives output

```
[blah]123
[blah]56
[blah]78

```

Basically, I want a "[blah]" inserted at the front, then inserted after every *non terminating* `std::endl`?

The difficulty here is NOT the logic management, but detecting and overloading the handling of `std::endl`. Is there an elegant way to do this?

Thanks!

EDIT: I don't need advice on logic management. I need to know how to detect/overload printing of `std::endl`.