This appears to work, however I'm very much open to feedback. One slight difficulty is that I would ideally like to make it compatible with std::endl, and I'm unsure how this would be achieved.
Since you're intent on reinventing std::ostream as closely as possible, here's how std::endl works with std::ostream.
This is a member function of [font="Courier New"]std::ostream[/font].
__ostream_type&
operator<<(__ostream_type& (*__pf)(__ostream_type&))
{
return __pf(*this);
}
It's a member function that takes a function that operates on the ostream and calls it. Now here's [font="Courier New"]std::endl[/font].
template<typename _CharT, typename _Traits>
inline basic_ostream<_CharT, _Traits>&
endl(basic_ostream<_CharT, _Traits>& __os)
{ return flush(__os.put(__os.widen('\n'))); }
It's a function that operates on an ostream. If you pass the address of [font="Courier New"]std::endl[/font] to [font="Courier New"]std::ostream::operator<<()[/font], it will just call the function. Clever, no?
Using manipulators with parameters is a little trickier: you end up creating a functor that passes the function bound to its parameter (currying). It's not rocket surgery.
I would really recommend just sticking with [font="Courier New"]std::clog[/font] as your logger an replacing its streambuf. You are unlikely to do better and you stand to lose a lot of functionality when you reinvent it yourself.