Hi.

I have a case where I'm copying a file onto a POP3 or SMTP connection, but I might also want to call Logger::dump() on the data as it's being sent.

Currently my method looks like:

std::size MyClass::sendFile(const std::string& filePath)
{
        Poco::FileInputStream fis(filePath);
        Poco::Net::SocketStream ss(socket());
        Poco::Net::MailOutputStream mos(ss);
        Poco::CountingOutputStream cos(mos);

        Poco::StreamCopier::copyStream(fis, cos);

        cos.flush();
        return cos.chars();
}

anyone have any clever ways to do this?

I could either use a TeeStream between the MailOutputStream and the SocketStream… and then when debugging, do an ::addStream() to go to another object…

But that object would have to be something that implements Logger::dump() as it's writeToDevice() method's internals…

Anyone see any easier way to address this?

Thanks,

-Philip