Thanks high_flyer (but I dont understand you)
This is my function (for strings):

Qt Code:
  1. W_debug& W_debug::operator << (const char * data) {
  2. if (strcmp (data,"")==0)
  3. { switch (log_file_mode)
  4. {
  5. case 0:
  6. qDebug()<<QString().fromStdString(os.str());
  7. break;
  8. case 1:
  9. log_file->write(os.str());
  10. break;
  11. case 2:
  12. my_window->add(os.str()); // another custom class
  13. break;
  14. }
  15. os.clear(); os.str("");
  16. }
  17. else
  18. { os<<data; return *this; } // os is a std::stream
  19. }
To copy to clipboard, switch view to plain text mode 


As you can see I use "" detection to resolve that the user has ended the call.
If not, I cannot to have more than one message per line.
(because, regardless the 'log_mode' method I use, every << will emit the result )
So the question are unresolved, (or I dont understand your explanation) :
If I have w_debug()<<"a word"<< data1<<"a word"<< data2;
How can I know the end of << feeding .,

Thanks


Mcosta : thanks, but I need more control over the messages and QtGlobal::qInstallMsgHandler() perhaps is useful, but I want to develop my own 'w_debug'.